News for hackers. Stuff that matters.
Re:Show HN: Datagridxl.js – No-nonsense fast Excel-like data... by rowsncolumns on Wednesday July 22, 2020 @04:18AM (#23914975)
If a user is trying to scroll horizontally, we can get the delta and get the scroll direction. Find the column width of the next/prev column and update the scroll property. An implementation can look like:

const nextColumnIndex = scrollDeltaX < 0 ? Math.max(0, columnStart - 1) : Math.min(columnStart, columnCount - 1);

const columnWidth = getColumnWidth( nextColumnIndex );

scrollBar.scrollLeft += (scrollDeltaX < 0 ? -1 : 1) * columnWidth;

There are no comments on this comment yet.