@@ -717,7 +717,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
717717 return ;
718718 }
719719 if ( ! this . _bScrollInternal ) {
720- this . _calcVirtualHeight ( event . target . scrollTop ) ;
720+ this . _calcVirtualScrollTop ( event . target . scrollTop ) ;
721721 } else {
722722 this . _bScrollInternal = false ;
723723 }
@@ -1284,14 +1284,19 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
12841284 }
12851285 private _updateVScrollOffset ( ) {
12861286 let scrollOffset = 0 ;
1287- this . _calcVirtualHeight ( this . scrollPosition ) ;
1287+ let currentScrollTop = this . scrollPosition ;
1288+ if ( this . _virtHeightRatio !== 1 ) {
1289+ this . _calcVirtualScrollTop ( this . scrollPosition ) ;
1290+ currentScrollTop = this . _virtScrollTop ;
1291+ }
1292+
12881293 const vScroll = this . scrollComponent . nativeElement ;
12891294 scrollOffset = vScroll && this . scrollComponent . size ?
1290- this . _virtScrollTop - this . sizesCache [ this . state . startIndex ] : 0 ;
1295+ currentScrollTop - this . sizesCache [ this . state . startIndex ] : 0 ;
12911296 this . dc . instance . _viewContainer . element . nativeElement . style . top = - ( scrollOffset ) + 'px' ;
12921297 }
12931298
1294- protected _calcVirtualHeight ( scrollTop : number ) {
1299+ protected _calcVirtualScrollTop ( scrollTop : number ) {
12951300 const containerSize = parseInt ( this . igxForContainerSize , 10 ) ;
12961301 const maxRealScrollTop = this . scrollComponent . size - containerSize ;
12971302 const realPercentScrolled = maxRealScrollTop !== 0 ? scrollTop / maxRealScrollTop : 0 ;
@@ -1570,7 +1575,7 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
15701575 return ;
15711576 }
15721577 if ( ! this . _bScrollInternal ) {
1573- this . _calcVirtualHeight ( event . target . scrollTop ) ;
1578+ this . _calcVirtualScrollTop ( event . target . scrollTop ) ;
15741579 } else {
15751580 this . _bScrollInternal = false ;
15761581 }
0 commit comments