Skip to content

Artboard tool: Alt-drag duplicates the artboard (and its art) - #348

Merged
bflatastic merged 2 commits into
storytold:mainfrom
theironchef:fix/artboard-alt-drag-duplicates
Oct 7, 2026
Merged

bflatastic merged 2 commits into
storytold:mainfrom
theironchef:fix/artboard-alt-drag-duplicates

Conversation

@theironchef

Copy link
Copy Markdown
Contributor

Fixes #346.

Problem: with the Artboard tool, Alt-dragging an artboard moved it like a plain drag. In Illustrator it duplicates the artboard: the copy follows the pointer and, with Move/Copy Artwork on, carries copies of its artwork (Duplicate artboards). artboard.duplicate exists but always puts the copy right of the last artboard, without art.

Change

  • artboard.move (engine, cmd/xform.rs) takes copy?: bool.
    • With it, the artboard and the art it carries stay put. A copy of the artboard, with a new id and named " copy", is moved by dx/dy, along with copies of that art.
    • Each art copy is re-numbered (Document::reid) and inserted just above its original.
    • The step is labelled "Duplicate Artboard", and the result's index is the copy's.
    • Without copy, nothing changes.
  • The Artboard tool (tools/src/xform/artboard.rs) sends copy while Alt is held during a move drag. The step begins as "Duplicate Artboard" or "Move Artboard".
  • The params doc and the tool's module doc say so.

Tests

  • New engine test artboard_alt_drag_duplicates_it_with_its_art, an Alt-drag through Session::pointer with the Artboard tool:
    • the result is two artboards: the original unmoved, and "Artboard 1 copy" 900 pt right with a new id;
    • the rectangle stays, and its copy sits 900 pt right;
    • History says "Duplicate Artboard", and one Undo removes both copies.
  • It fails with the old tool (one artboard).
  • New tool test alt_drag_moves_a_copy_of_the_artboard: the preview's copy flag and the Cancel/Begin switch when Alt changes mid-drag.
  • The existing move_resize_create_delete now expects "copy": false in the move preview.
  • cargo test -p vectorcraft-tools (189) and -p vectorcraft-engine (1254 and the integration tests, command sweep included): all passed.
  • cargo clippy -p vectorcraft-tools -p vectorcraft-engine --all-targets -- -D warnings (Rust 1.99): clean.
  • cargo fmt --all -- --check: clean.
  • Checked by hand in a release build on Windows with real mouse and keyboard input:
    • in a 200 × 150 pt document with a rectangle, I Alt-dragged the artboard 220 pt right with the Artboard tool;
    • the result is "Artboard 1" still at x = 0 with its rectangle, plus "Artboard 1 copy" at x = 220 with a copy of the rectangle (x = 270);
    • History says "Duplicate Artboard", and the copy is the active artboard.

Fixed build: before, one artboard; after an Alt-drag to the right with the Artboard tool, the artboard stays and a copy with a copy of its rectangle sits to its right

I didn't run the full cargo xtask ci (wasm step) here.

🤖 Generated with Claude Code

theironchef and others added 2 commits October 8, 2026 03:22
Alt-dragging an artboard moved it like a plain drag. artboard.move now
takes copy: it leaves the artboard (and the art it carries) where it
is and moves a copy, named "<name> copy", with copies of that art. The
Artboard tool previews it while Alt is held, as "Duplicate Artboard"
(Alt pressed or released mid-drag switches between copy and move),
and makes the copy the active artboard, as in the reference app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t the copies (review of storytold#348)

artboard.move with copy and artboard.duplicate now make the copy with one helper: a
new id that can't overflow and a name of its own (`<name> copy`, then `<name> copy 2`…,
so two copies of one artboard no longer share a name). `moved` lists the copies a copy
moved rather than the originals it left. Test it with and without moveArt, and note
Alt-drag in the ROADMAP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bflatastic
bflatastic force-pushed the fix/artboard-alt-drag-duplicates branch from 33f9a93 to 17e654a Compare October 7, 2026 20:52
@bflatastic
bflatastic merged commit 2bdb739 into storytold:main Oct 7, 2026
@bflatastic

Copy link
Copy Markdown
Member

Thanks @theironchef, merged! Alt-drag with the Artboard tool now duplicates the artboard, with its art when Move/Copy Artwork with Artboard is on, and Alt pressed or released mid-drag switches between copy and move. I rebased it on main and added one commit on top:

  • artboard.move {copy} and artboard.duplicate now share one copy helper.
  • Over MCP I found that two copies of the same artboard were both named "Artboard 1 copy". They're now "copy", "copy 2" and so on.
  • moved reports the copies' ids rather than the originals'.
  • An engine test, and updates to the params doc and the ROADMAP.

Live check: an Alt-drag made "Artboard 1 copy" with its 6 objects copied, and one undo removed both. Releasing Alt mid-drag gave a plain move. Over MCP, artboard.move {copy, moveArt} returned {index: 1, moved: [7]}.

h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 7, 2026
Add Snapping to the Artboard Tool

Merged with the Artboard tool's Alt-drag duplicate (#348): a copy snaps too, and to the artboard
and art it leaves behind (a move skips them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Artboard tool: Alt-drag moves the artboard instead of duplicating it

2 participants