Let a widget be dragged onto any row, including the top
Dragging a widget over apps used to move it in the order, but a wide widget can't fit beside earlier apps, so the packed flow kept pushing it below them. A widget now always goes to the cell under it (MOVE_CELL) and the apps flow around it; apps still reorder by dragging over each other. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NYASJ6JNxhYwNNJK7ypK2V
This commit is contained in:
2 files changed
+11
-5
No files matched your search
+5
-2
@@ -185,12 +185,15 @@
|
||||
const r = lifted.getBoundingClientRect();
|
||||
carry = { dx: x0 - r.left, dy: y0 - r.top, cell: -1 };
|
||||
}
|
||||
if (inside(lifted.getBoundingClientRect(), x, y)) return;
|
||||
// A widget goes to the cell under it wherever that is (apps flow around it), so it
|
||||
// can sit on any row; an app over another app takes its place in the order.
|
||||
const widget = lifted.classList.contains("widget-slot");
|
||||
if (!widget && inside(lifted.getBoundingClientRect(), x, y)) return;
|
||||
// the cell under the finger: a slot there takes the lifted one's place in the order
|
||||
const [fc, fr] = cellAt(g, x - g.colW / 2, y - g.cell / 2);
|
||||
const to = slotAt(x, y) >= 0 ? slotAt(x, y)
|
||||
: slotAt(g.left + fc * (g.colW + g.gap) + g.colW / 2, g.top + fr * (g.cell + g.rgap) + g.cell / 2);
|
||||
if (to >= 0) { carry.cell = -1; app.dispatch(DRAG_TO, to); return; }
|
||||
if (to >= 0 && !widget) { carry.cell = -1; app.dispatch(DRAG_TO, to); return; }
|
||||
if (y > g.top + g.rows * (g.cell + g.rgap)) return; // below the grid
|
||||
const [col, row] = cellAt(g, x - carry.dx, y - carry.dy);
|
||||
const cell = row * 64 + Math.min(col, 63);
|
||||
|
||||
Reference in new issue
Block a user