@@ -1232,6 +1232,10 @@ var VirtualRenderer = function(container, theme) {
1232
1232
1233
1233
var topMargin = $viewMargin && $viewMargin . top || 0 ;
1234
1234
var bottomMargin = $viewMargin && $viewMargin . bottom || 0 ;
1235
+
1236
+ if ( this . $scrollAnimation ) {
1237
+ this . $stopAnimation = true ;
1238
+ }
1235
1239
1236
1240
var scrollTop = this . $scrollAnimation ? this . session . getScrollTop ( ) : this . scrollTop ;
1237
1241
@@ -1378,7 +1382,20 @@ var VirtualRenderer = function(container, theme) {
1378
1382
_self . session . setScrollTop ( steps . shift ( ) ) ;
1379
1383
// trick session to think it's already scrolled to not loose toValue
1380
1384
_self . session . $scrollTop = toValue ;
1385
+
1386
+ function endAnimation ( ) {
1387
+ _self . $timer = clearInterval ( _self . $timer ) ;
1388
+ _self . $scrollAnimation = null ;
1389
+ _self . $stopAnimation = false ;
1390
+ callback && callback ( ) ;
1391
+ }
1392
+
1381
1393
this . $timer = setInterval ( function ( ) {
1394
+ if ( _self . $stopAnimation ) {
1395
+ endAnimation ( ) ;
1396
+ return ;
1397
+ }
1398
+
1382
1399
if ( ! _self . session )
1383
1400
return clearInterval ( _self . $timer ) ;
1384
1401
if ( steps . length ) {
@@ -1390,9 +1407,7 @@ var VirtualRenderer = function(container, theme) {
1390
1407
toValue = null ;
1391
1408
} else {
1392
1409
// do this on separate step to not get spurious scroll event from scrollbar
1393
- _self . $timer = clearInterval ( _self . $timer ) ;
1394
- _self . $scrollAnimation = null ;
1395
- callback && callback ( ) ;
1410
+ endAnimation ( ) ;
1396
1411
}
1397
1412
} , 10 ) ;
1398
1413
} ;
0 commit comments