From 70d685992e5d68013d77b2387a1aaaed199b504f Mon Sep 17 00:00:00 2001 From: Hannes Widmoser Date: Wed, 11 May 2016 12:06:03 +0200 Subject: [PATCH] Make overflow dynamically configurable --- demo/index.html | 4 ++++ dist/tileview.js | 5 +++-- src/tileview.ts | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/demo/index.html b/demo/index.html index d4496e5..c2fc3e9 100644 --- a/demo/index.html +++ b/demo/index.html @@ -49,6 +49,10 @@ +
+ + +
diff --git a/dist/tileview.js b/dist/tileview.js index 8f1ddfd..995fc07 100644 --- a/dist/tileview.js +++ b/dist/tileview.js @@ -31,7 +31,7 @@ * - **scrollEndOffset** - {number} - Some features that rely on the `scrollEnd` callback need to be informed in advance. * This property specifies an offset in rows to trigger the scroll end event before actually hitting the bottom of the data. **Default**: 0 * - **overflow** - {number} - Number of rows that are rendered additionally to the visible rows to make the scrolling experience more fluent. **Default**: 2 - * - **debounce** - {number} - Debounce in milliseconds. This will only affect the calls to `$digest`. The cells will still be moved smoothly. A value of `0` is interpreted as no debounce. **Default**: 0. + * - **debounce** - {number} - Debounce for the scroll event. A value of `0` is interpreted as no debounce. **Default**: 0. */ mod.directive('tdTileview', ['$compile', '$templateCache', '$timeout', '$window', function ($compile, $templateCache, $timeout, $window) { return { @@ -107,6 +107,7 @@ lastScrollPosition = Number.NEGATIVE_INFINITY; layout(); }); + scope.$watch('options.overflow', layout); scope.$on('td.tileview.resize', resize); angular.element($window).on('resize', onResize); scope.$on('$destroy', function () { @@ -270,7 +271,7 @@ debounceTimeout = $timeout(function () { debounceTimeout = undefined; update(); - }, scope.options.debounce); + }, scope.options.debounce, false); } } else { diff --git a/src/tileview.ts b/src/tileview.ts index 378cccc..33ecbc7 100644 --- a/src/tileview.ts +++ b/src/tileview.ts @@ -116,6 +116,7 @@ declare const angular: any; lastScrollPosition = Number.NEGATIVE_INFINITY; layout(); }); + scope.$watch('options.overflow', layout); scope.$on('td.tileview.resize', resize); angular.element($window).on('resize', onResize); @@ -306,7 +307,7 @@ declare const angular: any; debounceTimeout = $timeout(function() { debounceTimeout = undefined; update(); - }, scope.options.debounce); + }, scope.options.debounce, false); } } else { update();