Skip to content

Commit c29dc15

Browse files
committed
fix(for-of): Skip logic on small scrolls
Closes #7206
1 parent dbef411 commit c29dc15

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

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

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -853,63 +853,17 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
853853
if (newStart + this.state.chunkSize > count) {
854854
newStart = count - this.state.chunkSize;
855855
}
856-
const prevStart = this.state.startIndex;
857856
const diff = newStart - this.state.startIndex;
858857
this.state.startIndex = newStart;
859858
if (diff) {
860859
this.onChunkPreload.emit(this.state);
861860
if (!this.isRemote) {
862-
/*recalculate and apply page size.*/
863-
if (diff > 0 && diff <= this.MAX_PERF_SCROLL_DIFF) {
864-
this.moveApplyScrollNext(prevStart);
865-
} else if (diff < 0 && Math.abs(diff) <= this.MAX_PERF_SCROLL_DIFF) {
866-
this.moveApplyScrollPrev(prevStart);
867-
} else {
868-
this.fixedApplyScroll();
869-
}
861+
this.fixedApplyScroll();
870862
}
871863
}
872864
return inScrollTop - this.sizesCache[this.state.startIndex];
873865
}
874866

875-
/**
876-
* @hidden
877-
* The function applies an optimized state change for scrolling down/right employing context change with view rearrangement
878-
*/
879-
protected moveApplyScrollNext(prevIndex: number): void {
880-
const start = prevIndex + this.state.chunkSize;
881-
for (let i = start; i < start + this.state.startIndex - prevIndex && this.igxForOf[i] !== undefined; i++) {
882-
this._moveApply(i);
883-
}
884-
}
885-
886-
/**
887-
*
888-
*/
889-
protected _moveApply(contextIndex: number, topPosition = false) {
890-
const context = this.igxForOf[contextIndex];
891-
const forOfContext = new IgxForOfContext<T>(context, this.getContextIndex(context), this.igxForOf.length);
892-
const view = this.dc.instance._vcr.createEmbeddedView(this._template, forOfContext, topPosition ? 0 : undefined);
893-
this.dc.instance._vcr.detach(topPosition ? this.dc.instance._vcr.length - 1 : 0);
894-
if (topPosition) {
895-
this._embeddedViews.pop();
896-
this._embeddedViews.unshift(view);
897-
} else {
898-
this._embeddedViews.shift();
899-
this._embeddedViews.push(view);
900-
}
901-
}
902-
903-
/**
904-
* @hidden
905-
* The function applies an optimized state change for scrolling up/left employing context change with view rearrangement
906-
*/
907-
protected moveApplyScrollPrev(prevIndex: number): void {
908-
for (let i = prevIndex - 1; i >= this.state.startIndex && this.igxForOf[i] !== undefined; i--) {
909-
this._moveApply(i, true);
910-
}
911-
}
912-
913867
/**
914868
* @hidden
915869
*/

0 commit comments

Comments
 (0)