Repository navigation
Drag a selection to move it all at once - #400
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 27, 2026
SunkenInTime
force-pushed
the
t3/canvas-group-move
branch
from
October 28, 2026 00:10
196ce92 to
4eb55f2
Compare
A group move on the canvas needs to shift drawings, which could only be added and removed. translateDrawings moves every point and bounding box of the named drawings in place in the stack and records one edit per drawing, so a move inside performTransaction undoes as one step with the widgets moved beside it. Drawing edits replay through the same field-by-field path as other kinds: a drawing now has history JSON (the same fields saves and live sync write), so undo skips a drawing a teammate deleted, keeps a colour they changed, and counts a move they already put back as no change.
Pressing a selected item drags the whole selection: everything is drawn where the drag carries it (drawings and view cones too) and moves for real, as one undo step, on release. The drag stops before anything would leave the map, Escape drops it, and lineups stay where they are. A lone selected drawing can now be dragged too.
Review found the selection's drag took every press on a selected item, so resize and rotate handles and a text item's click stopped working, a click could land on the wrong item, a selection grown mid-drag moved unclamped items off the map (agents dropped there are deleted), and Space mid-drag left items drawn where they were never moved. The selection's drag now competes like any drag: an item's own drag stands aside while it is one of several selected (itemDragLimit), handles and taps keep theirs. A drag carries the items it began with, a click goes to what the press landed on, and a drag under way keeps its recognizer until it ends.
SunkenInTime
force-pushed
the
t3/canvas-group-move
branch
from
October 28, 2026 01:56
4eb55f2 to
043a666
Compare
SunkenInTime
force-pushed
the
t3/canvas-selection
branch
from
October 28, 2026 01:56
36490fc to
266c52a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows release build, real input: a box selects everything, dragging one agent carries all of it (stroke included), one Ctrl+Z puts it all back, then a lone selected stroke is dragged on its own, which wasn't possible before.
This is the second PR in the selection stack. It sits on #399, and #401 sits on it; the three merge together. Now that items can be selected, the obvious next move is to drag them as a group.
What changes
How
DrawingProvider.translateDrawings(separate commit) moves every point. It records a real edit history entry per drawing, not delete plus add, which could bring back a drawing a teammate deleted.ActionObjectStategives drawings a JSON form, so undo and redo replay through the same field-by-field path as other items: a teammate's delete is skipped, and a teammate's colour change survives.canvasGroupDragProviderholds{ids, by}.EditorEntityLayertranslates its item if the drag carries it. TheTransformis always present, so an item never remounts mid-drag.DrawingPaintershifts the carried strokes.ConeCoverage.moved()repaints the cones. They only repaint on layout, and a translate isn't a layout change.Draggablestands aside (maxSimultaneousDrags: itemDragLimit(context)). Handles and taps keep winning: resize and rotate handles, and a click on text to edit it.Review
Astra's first round found four bugs in the earlier, eager version of this drag, and all four are fixed in the second commit:
Each has a regression test. A second round found nothing further here; its one note, that touch and pen drags were blocked, is also fixed.
Ground truth
Not covered
field_merge).ci: analyze test web