Skip to content

Commit f093cdf

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Add special handling for virtual ratio scrollbar.
1 parent 8b0cd79 commit f093cdf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
870870
const maxVirtScrollTop = this._virtSize - containerSize;
871871
this._bScrollInternal = true;
872872
this._virtScrollPosition = maxVirtScrollTop;
873-
this.scrollPosition = maxVirtScrollTop;
873+
this.scrollPosition = maxVirtScrollTop / this._virtRatio;
874874
return;
875875
}
876876
if (this._adjustToIndex) {
@@ -1469,7 +1469,16 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
14691469
}
14701470

14711471
protected _updateScrollOffset() {
1472-
const scrollOffset = this.fixedUpdateAllElements(this._virtScrollPosition);
1472+
let scrollOffset = 0;
1473+
let currentScroll = this.scrollPosition;
1474+
if (this._virtRatio !== 1) {
1475+
this._calcVirtualScrollPosition(this.scrollPosition);
1476+
scrollOffset = this.fixedUpdateAllElements(this._virtScrollPosition);
1477+
} else {
1478+
const scroll = this.scrollComponent.nativeElement;
1479+
scrollOffset = scroll && this.scrollComponent.size ?
1480+
currentScroll - this.sizesCache[this.state.startIndex] : 0;
1481+
}
14731482
const dir = this.igxForScrollOrientation === 'horizontal' ? 'left' : 'top';
14741483
this.dc.instance._viewContainer.element.nativeElement.style[dir] = -(scrollOffset) + 'px';
14751484
}

0 commit comments

Comments
 (0)