Skip to content

Commit b0f8d33

Browse files
MKirovaMayaKirova
authored andcommitted
chore(*): Rename method and use only if browser height is exeeded.
1 parent 501b31d commit b0f8d33

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
732732
return;
733733
}
734734
if (!this._bScrollInternal) {
735-
this._calcVirtualHeight(event.target.scrollTop);
735+
this._calcVirtualScrollTop(event.target.scrollTop);
736736
} else {
737737
this._bScrollInternal = false;
738738
}
@@ -1301,14 +1301,19 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
13011301
}
13021302
private _updateVScrollOffset() {
13031303
let scrollOffset = 0;
1304-
this._calcVirtualHeight(this.scrollPosition);
1304+
let currentScrollTop = this.scrollPosition;
1305+
if (this._virtHeightRatio !== 1) {
1306+
this._calcVirtualScrollTop(this.scrollPosition);
1307+
currentScrollTop = this._virtScrollTop;
1308+
}
1309+
13051310
const vScroll = this.scrollComponent.nativeElement;
13061311
scrollOffset = vScroll && this.scrollComponent.size ?
1307-
this._virtScrollTop - this.sizesCache[this.state.startIndex] : 0;
1312+
currentScrollTop - this.sizesCache[this.state.startIndex] : 0;
13081313
this.dc.instance._viewContainer.element.nativeElement.style.top = -(scrollOffset) + 'px';
13091314
}
13101315

1311-
protected _calcVirtualHeight(scrollTop: number) {
1316+
protected _calcVirtualScrollTop(scrollTop: number) {
13121317
const containerSize = parseInt(this.igxForContainerSize, 10);
13131318
const maxRealScrollTop = this.scrollComponent.size - containerSize;
13141319
const realPercentScrolled = maxRealScrollTop !== 0 ? scrollTop / maxRealScrollTop : 0;
@@ -1587,7 +1592,7 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
15871592
return;
15881593
}
15891594
if (!this._bScrollInternal) {
1590-
this._calcVirtualHeight(event.target.scrollTop);
1595+
this._calcVirtualScrollTop(event.target.scrollTop);
15911596
} else {
15921597
this._bScrollInternal = false;
15931598
}

0 commit comments

Comments
 (0)