@@ -346,23 +346,23 @@ VirtualRepeatContainerController.prototype.resetScroll = function() {
346
346
347
347
VirtualRepeatContainerController . prototype . handleScroll_ = function ( ) {
348
348
var offset = this . isHorizontal ( ) ? this . scroller . scrollLeft : this . scroller . scrollTop ;
349
- if ( offset === this . scrollOffset ) return ;
349
+ if ( offset === this . scrollOffset || offset > this . scrollSize - this . size ) return ;
350
350
351
351
var itemSize = this . repeater . getItemSize ( ) ;
352
352
if ( ! itemSize ) return ;
353
353
354
354
var numItems = Math . max ( 0 , Math . floor ( offset / itemSize ) - NUM_EXTRA ) ;
355
355
356
- var transform = this . isHorizontal ( ) ? 'translateX(' : 'translateY(' ;
357
- transform += ( numItems * itemSize ) + 'px)' ;
356
+ var transform = ( this . isHorizontal ( ) ? 'translateX(' : 'translateY(' ) +
357
+ ( numItems * itemSize ) + 'px)' ;
358
358
359
359
this . scrollOffset = offset ;
360
360
this . offsetter . style . webkitTransform = transform ;
361
361
this . offsetter . style . transform = transform ;
362
362
363
363
if ( this . bindTopIndex ) {
364
364
var topIndex = Math . floor ( offset / itemSize ) ;
365
- if ( topIndex !== this . topIndex && topIndex < this . repeater . itemsLength ) {
365
+ if ( topIndex !== this . topIndex && topIndex < this . repeater . getItemCount ( ) ) {
366
366
this . topIndex = topIndex ;
367
367
this . bindTopIndex . assign ( this . $scope , topIndex ) ;
368
368
if ( ! this . $rootScope . $$phase ) this . $scope . $digest ( ) ;
@@ -627,6 +627,15 @@ VirtualRepeatController.prototype.getItemSize = function() {
627
627
} ;
628
628
629
629
630
+ /**
631
+ * Called by the container. Returns the size of a single repeated item.
632
+ * @return {?number } Size of a repeated item.
633
+ */
634
+ VirtualRepeatController . prototype . getItemCount = function ( ) {
635
+ return this . itemsLength ;
636
+ } ;
637
+
638
+
630
639
/**
631
640
* Updates the order and visible offset of repeated blocks in response to scrolling
632
641
* or items updates.
0 commit comments