fix(engine): Alt-drag copies snap to their original; Duplicate repeats the step

- A copy Alt-dragged off a layer snaps to that layer too: its edges,
  centres and equal spacing (Targets::add_box with the originals' box).
  Before, the originals were left out of the snap targets, so a copy
  couldn't line up with or space evenly from the layer it came from.
- Duplicate (Cmd+D) repeats the last duplicate's page offset while its
  copies are what it duplicates: Alt-drag a copy, or Duplicate and move
  the copy, then each Cmd+D steps out the next one as far again. The
  step is measured when Duplicate runs. It lasts as long as the
  selection (undo reuses ids), copies placed by an auto layout set no
  step, and explicit dx/dy win.
- measure_tests: an Alt-dragged copy between its original and another
  layer now snaps to equal spacing (45/45 instead of 50/40).

Tests: duplicate_spacing_tests (snap to the original, equal spacing,
repeat after moving a copy and after an Alt-drag, only for the last
copies, undo then a new layer, rotated frame, auto layout).

Refs #256

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
RealtaNua
2026-10-14 18:03:48 +07:00
co-authored by Claude Opus 5.5
parent bcedfeba10
commit 73b2845ba4
8 changed files with 253 additions and 22 deletions
+6
View File
@@ -1406,6 +1406,12 @@ turned off 0°.
With `pointer`, `alt: true` hovers measure (add `cmd` for nested layers, `shift` for padding) and
`alt` drags show live distances to the neighbours; `inspect_ui` reports them under
`tool.overlay` (`guides`, and `measure_box` for the box measured to).
- **Duplicating at a spacing**: a copy Alt-dragged off a layer with `pointer` snaps to that layer
too (its edges, centres and equal spacing). `edit.duplicate {ids?, dx?, dy?}` without `dx`/`dy`
repeats the last duplicate's page offset while its copies are what it duplicates (and still the
selection), measured when it runs: Alt-drag or duplicate and move a copy, then each
`edit.duplicate` steps out the next one as far again. Copies placed by an auto layout set no
step; explicit `dx`/`dy` always win.
- **Scale tool** (`tool.scale`, K): dragging a selection handle with `pointer` scales everything by
one factor (sizes and positions whatever the constraints, strokes, effects, corner radii, auto
layout spacing, min/max sizes, layout grids, guides, tiled images, text), one undo step per drag,
+1 -1
View File
@@ -55,7 +55,7 @@ interaction feel not yet compared.
| Flip, rotate 90° | done | |
| Rotation origin (Alt+R) | done | a handle at the selection's centre to drag (snaps to the box's corners, edge middles and centre), double-click puts it back, Escape or Alt+R hides it; the corner handles, the rotation field, Rotate 90°/180° and `transform.rotate` turn about it; it follows the layers and lasts as long as the selection, not saved (the documentation doesn't say; pinned) |
| Enter with a shape or frame tool chosen | done | places what a click makes (100×100, lines 100 long, sections 400×300) in the middle of the view, selected (`tool.place`); from the toolbar, Enter on the chosen tool. No crosshair to move with the arrows first |
| Alt-drag duplicate | done | |
| Alt-drag duplicate | done | the copy snaps to the layer it came from too (edges, centres, equal spacing); Duplicate (Cmd+D) then repeats the copy's offset, also after a Duplicate whose copy was moved, as long as the copies stay selected (the documentation doesn't say; pinned from community answers) |
| Drag threshold; double-click into groups and text | done | a press moves or resizes only once the pointer has travelled 3 px on screen, so a click or double-click made with an unsteady hand drags nothing; a double-click goes one level into a group and the next one edits the text under it, wherever on the text it lands, with all of it selected (a double-click in the text being edited selects the word) (`double_click_tests`); Enter on a selected text does the same (all of it selected, typing replaces it) and Escape leaves editing with the layer still selected (`text_enter_tests`) |
| Scale tool (K): handles about an anchor, live factor, panel | done | |
| Nudge 1 / Shift 10 (preference), Cmd+arrows resize | done | arrows reorder auto layout children |