Skip to content

Commit

Permalink
Fix autoscroll bugs that cause wonkly behaviors (#835)
Browse files Browse the repository at this point in the history
* Fix autoscroll bugs that cause wonkly behaviors

* Fix accidental story regression
  • Loading branch information
jassmith committed Dec 28, 2023
1 parent 278dc41 commit fc0d331
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/data-editor/data-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2518,14 +2518,14 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
let [col, row] = args.location;
const visible = visibleRegionRef.current;
if (xDir === -1) {
col = visible.x;
col = visible.extras?.freezeRegion?.x ?? visible.x;
} else if (xDir === 1) {
col = visible.x + visible.width;
}
if (yDir === -1) {
row = Math.max(0, visible.y);
} else if (yDir === 1) {
row = Math.min(rows, visible.y + visible.height);
row = Math.min(rows - 1, visible.y + visible.height);
}
onItemHoveredImpl({
...args,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/internal/data-grid/data-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ const DataGrid: React.ForwardRefRenderFunction<DataGridRef, DataGridProps> = (p,
const isTouch = (ev !== undefined && !(ev instanceof MouseEvent)) || (ev as any)?.pointerType === "touch";

const scrollEdge: GridMouseEventArgs["scrollEdge"] = [
x < stickyX ? -1 : rect.width < x ? 1 : 0,
x < 0 ? -1 : rect.width < x ? 1 : 0,
y < totalHeaderHeight ? -1 : rect.height < y ? 1 : 0,
];

Expand Down Expand Up @@ -655,7 +655,6 @@ const DataGrid: React.ForwardRefRenderFunction<DataGridRef, DataGridProps> = (p,
getBoundsForItem,
fillHandle,
selection,
stickyX,
totalHeaderHeight,
]
);
Expand Down

0 comments on commit fc0d331

Please sign in to comment.