Skip to content

Commit

Permalink
grid.View: afterSetScrollPosition() => only change the startIndex whe…
Browse files Browse the repository at this point in the history
…n scrolling more than the buffer row range #6190 WIP
  • Loading branch information
tobiu committed Jan 9, 2025
1 parent 4d7320c commit c2b69bf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/grid/View.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,22 @@ class GridView extends Component {
* @protected
*/
afterSetScrollPosition(value, oldValue) {
let me = this;
let me = this,
newStartIndex;

if (value.x !== oldValue?.x && me.columnPositions.length > 0) {
me.updateVisibleColumns()
}

if (value.y !== oldValue?.y) {
me.startIndex = Math.floor(value.y / me.rowHeight)
newStartIndex = Math.floor(value.y / me.rowHeight);

// console.log(Math.abs(me.startIndex - newStartIndex), me.bufferRowRange);

if (Math.abs(me.startIndex - newStartIndex) >= me.bufferRowRange) {
// console.log('update', newStartIndex);
me.startIndex = newStartIndex
}
}
}

Expand Down

0 comments on commit c2b69bf

Please sign in to comment.