mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 04:07:12 -06:00
Fix #798: the Curvature tool edits any selected path
The Curvature tool only edited the path it was drawing. It now edits any selected path, whatever drew it, keeping its shape except where edited: a click on a point makes it the current (direct-selected) point and a drag moves it, re-curving only its two segments (the neighbours keep their handle directions); Alt-click or double-click toggles it smooth or corner and Delete removes it; a click on a segment adds a smooth point without changing the shape, and a drag moves it in the same undo step. With an end of an open path current, clicks go on from it (the old segments keep their shape) and a click on the other end closes it. The edits go through a new path.curvatureEdit command (move, insert, extend, close), path.convertAnchor and path.removeAnchor, one undo step each. The tool now claims Delete/Backspace while it has a point to remove, so the key no longer deletes the whole path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
898c4f7677
commit
1db82cbc02
+20
@@ -1230,6 +1230,26 @@ the path it had begun while that stays selected. Its reply's `tool` is the tool
|
||||
{"name":"run_command","arguments":{"command":"path.moveAnchors","params":{"dx":0,"dy":40}}}
|
||||
```
|
||||
|
||||
## Editing a path with the Curvature tool
|
||||
|
||||
The Curvature tool edits any selected path, whatever drew it, keeping its shape except where edited (#798). Each edit
|
||||
is one undo step and leaves the anchor it edited direct-selected (the tool's current point):
|
||||
`path.curvatureEdit {id, subpath?, op, …}` answers `{anchor}`. `op: "move"` with `anchor`, `x`, `y` moves a point and
|
||||
re-curves only its two segments: a smooth point turns along the line through its neighbours, and the neighbours'
|
||||
handles keep their directions (their lengths scale with the chord), so the segments beyond don't change.
|
||||
`op: "insert"` with `segment`, `t` adds a smooth point there without changing the shape (with `x`, `y` it is then
|
||||
moved there: the tool's click-and-drag on a segment). `op: "extend"` with `x`, `y` goes on from the `end` (default)
|
||||
or the `start` of an open subpath, and `op: "close"` closes it from that end; `from` says how the old end bends into
|
||||
the new segment: `"keep"` (default) keeps its curve, `"smooth"` curves it through its neighbours (a point the tool
|
||||
placed), `"corner"` leaves it without handles. Alt-click or double-click toggles a point with `path.convertAnchor`, and
|
||||
Backspace/Delete removes the current point with `path.removeAnchor`.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"path.curvatureEdit","params":{"id":12,"op":"move","anchor":2,"x":260,"y":140}}}
|
||||
{"name":"run_command","arguments":{"command":"path.curvatureEdit","params":{"id":12,"op":"extend","end":"end","x":550,"y":120}}}
|
||||
{"name":"run_command","arguments":{"command":"path.curvatureEdit","params":{"id":12,"op":"extend","x":650,"y":60,"from":"smooth"}}}
|
||||
```
|
||||
|
||||
## Registration and trim marks
|
||||
|
||||
Every document has the built-in `[Registration]` swatch (listed after None by `swatch.list`): a colour that prints on
|
||||
|
||||
Reference in New Issue
Block a user