mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
Measure a new column drag after the last one's columns are home
A drag started while the last one's columns slid home read their edges mid-slide, and dropped against them. The list now ends that slide first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e37fca58a
commit
fd89201ccb
1 file changed
+5
-3
@@ -411,6 +411,11 @@ function useColumnDrag({
|
||||
const grid = gridRef.current;
|
||||
const from = latest.current.columns.findIndex((c) => c.id === e.active.id);
|
||||
if (grid == null || from === -1) return;
|
||||
const id = e.active.id as ColumnId;
|
||||
const x = pointer.current;
|
||||
// First, as it ends the last drag's columns sliding home, so the edges read below are where
|
||||
// the columns are laid out, not where they were sliding
|
||||
latest.current.onColumnDrag({ type: "start", id, x });
|
||||
const gridLeft = grid.getBoundingClientRect().left;
|
||||
const cells = Array.from(grid.querySelectorAll<HTMLElement>(":scope > [data-column]")).map(
|
||||
(el) => {
|
||||
@@ -418,11 +423,8 @@ function useColumnDrag({
|
||||
return { left: box.left - gridLeft, right: box.right - gridLeft };
|
||||
},
|
||||
);
|
||||
const id = e.active.id as ColumnId;
|
||||
const x = pointer.current;
|
||||
const shown = shownKey(latest.current.columns);
|
||||
state.current = { id, from, cells, shown, x, to: null, ghostX: x, frame: 0 };
|
||||
latest.current.onColumnDrag({ type: "start", id, x });
|
||||
target(state.current);
|
||||
|
||||
const tick = () => {
|
||||
|
||||
Reference in new issue
Block a user