Skip to content

Pen: holding Space while dragging out a point moves it - #315

Merged
bflatastic merged 2 commits into
storytold:mainfrom
theironchef:fix/pen-space-moves-anchor
Oct 7, 2026
Merged

bflatastic merged 2 commits into
storytold:mainfrom
theironchef:fix/pen-space-moves-anchor

Conversation

@theironchef

Copy link
Copy Markdown
Contributor

Fixes #313. Stacked on #310: the first commit here is #310's. Once that one merges, this PR shows only its own commit.

Problem: the Pen never read Space during a drag. Holding it while dragging out a point left the anchor where the button went down, and its handles swung round it. In Illustrator, holding the spacebar while the button is still down moves the anchor being placed, with its handles. That's the Pen's counterpart of #302 / #304 for the shape tools.

Change (crates/tools/src/pen.rs)

  • PenTool remembers the pointer at the last button-down or drag (last).
  • In the Drag arm, while Space is held (and the drag isn't closing the path), the anchor moves as far as the pointer did. The outgoing handle is the pointer and the incoming one mirrors it, so both move with it.
  • The incoming handle Alt kept (Pen: Alt pressed mid-drag keeps the curve into the new anchor #310) moves along too.
  • Releasing Space goes back to shaping the handles round the anchor's new place.
  • This covers the first anchor of a new path (path.create) and an anchor added to a path (path.appendAnchor).
  • The canvas already passes Space to the tool during a drag (canvas::mods(m, space)), so nothing else changes.
  • The module doc says so.

Tests

  • New pen::tests::space_moves_the_anchor_being_placed:
    • for a new path's first anchor, Space held moves the point, handles and all, and once released the drag shapes the handles round the new place;
    • for an anchor added to an open path, with Alt and Space held, the anchor and the kept incoming handle move together.
  • With the Space branch disabled, the test fails (the anchor stays at y = 420).
  • cargo test -p vectorcraft-tools: 190 passed.
  • cargo test -p vectorcraft-engine --lib pen: 59 passed.
  • cargo clippy -p vectorcraft-tools --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:
    • I clicked, pressed further on and dragged right, held Space and dragged 50 pt up, released Space and dragged on.
    • The point rode up with its handles, and then the drag shaped the handles again. The view didn't pan.
    • The committed path is M0.5 50.576 C0.5 50.576 20.53 20.303 100.652 0.5: the anchor at about (150, 100) instead of (150, 150), with its incoming handle mirroring the final outgoing one.

Fixed build: dragging out a smooth point, holding Space and dragging up (the point moves with its handles), then releasing Space (the drag shapes the handles again)

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
…s it

The Pen ignored Space during a drag, so the anchor being placed stayed
where the button went down and its handles swung round it. Space held
now moves the anchor, handles and all, as far as the pointer moves
(the handle Alt kept moves along too); releasing Space goes back to
shaping the handles round the new place, as in the reference app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bflatastic
bflatastic force-pushed the fix/pen-space-moves-anchor branch from 7fbd477 to c322f24 Compare October 7, 2026 20:48
@bflatastic
bflatastic merged commit 7487782 into storytold:main Oct 7, 2026
@bflatastic

Copy link
Copy Markdown
Member

Thanks @theironchef, merged! Holding Space while dragging out a point now moves it, handles and all. I rebased it on main and added the ROADMAP entry in a commit on top.

Live check: Space held mid-drag moved the anchor to (300,60) with its handles at (240,60) / (360,60), and releasing Space went back to shaping the handles. Also checked over MCP. One follow-up you might like: Illustrator also lets Space reposition the closing anchor while closing a path.

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: Pen tool: holding Space while dragging out a point doesn't move it

2 participants