mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 12:38:18 +00:00
Merge pull request #8690 from dotCooCoo/feat/quick-pen
Pen: Quick Pen tool draws lines, continuous arcs and sharp-corner arcs
This commit is contained in:
+42
@@ -6982,6 +6982,48 @@ toggles a point with `path.convertAnchor`; an Alt-click on an end of an open sub
|
||||
{"name":"run_command","arguments":{"command":"path.curvatureEdit","params":{"id":12,"op":"extend","x":650,"y":60,"from":"smooth"}}}
|
||||
```
|
||||
|
||||
## Drawing with the Quick Pen tool
|
||||
|
||||
The Quick Pen tool (`quickPen`, in the Pen tool's group, Alt+P or Option+P on macOS) draws paths of straight lines and
|
||||
circular arcs ([Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html),
|
||||
[Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)).
|
||||
A click sets the start point. Each click after it, or a press dragged to where it is let go, adds a piece from the
|
||||
path's last point, drawn with the tool's `action` option:
|
||||
|
||||
- `"line"` (the default): a straight line.
|
||||
- `"continuousArc"`: an arc that leaves the last point in the direction the path arrives there, so the two join
|
||||
smoothly. The first piece of a path has no direction and is drawn as a sharp-corner arc; an end straight ahead of or
|
||||
straight behind the last point gives a line.
|
||||
- `"sharpArc"`: an arc that turns through the tool's `turn` option (degrees, 1 to 359, 180 by default: a half circle)
|
||||
and bulges to the left of the direction drawn, meeting the path before it at a corner.
|
||||
|
||||
Alt (Option on macOS) pressed and let go with no other key, click or wheel turn in between switches to the next action:
|
||||
Line, Continuous Arc, Sharp Corner Arc, and back to Line. C flips the last piece, while it is a sharp-corner arc, to
|
||||
the other side of its chord. `[` and `]` make the arc size 15° smaller or larger, for the last sharp-corner arc and the
|
||||
arcs after it. A click on the first point closes the path, and a click on an end of an open path goes on drawing from
|
||||
that end. Escape or Enter ends the path, and so does an edit made to it by another command. The path's points show as circles without handles, and a preview shows the
|
||||
piece the next click adds. Points snap to Smart Guides. Each piece, flip and size change is one undo step. The arc
|
||||
size of 180°, its 15° steps, the side an arc bulges to and Enter ending the path are VectorCraft's own rules. The
|
||||
tool keeps `action` and `turn` with the preferences (`tool.setOption {tool: "quickPen", key, value}`).
|
||||
|
||||
`path.quickPen {start?: [x, y], id?, subpath?, keep?, pieces?, closed?}` draws such a path and selects it, as one
|
||||
undo step, and answers `{id}`. With `start`, it makes a new path with the current paint (a black stroke when the paint
|
||||
has neither fill nor stroke). With `id`, it draws on the open subpath `subpath` (0 when left out) of that path: its
|
||||
first `keep` points stay (all of them when left out) and the pieces follow. Each piece is
|
||||
`{x, y, action?, turn?, flip?}`: it ends at `x`, `y`, `action` is `"line"` when left out, `turn` is 180 when left out,
|
||||
and `flip` puts a sharp-corner arc on the right of the direction drawn. A piece that ends where the path does adds
|
||||
nothing. With `closed: true`, a last piece that ends on the first point joins it; otherwise a straight segment closes
|
||||
the path. The command returns an error and changes nothing when both or neither of `start` and `id` are given
|
||||
(`` give either `start` for a new path or `id`, not both ``), when `subpath` or `keep` comes without `id`, when
|
||||
`pieces` is not a list of at most 10000 pieces, when a point's x or y is not a number or is 1e9 or more in size, for
|
||||
an unknown `action`, a `turn` outside 1 to 359, a `flip` or `closed` that is not true or false, a `keep` outside 1 to
|
||||
the subpath's points, and for a closed subpath, a locked or hidden path or an `id` that is not a path.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"path.quickPen","params":{"start":[100,100],"pieces":[{"x":200,"y":100},{"x":300,"y":200,"action":"continuousArc"},{"x":300,"y":300,"action":"sharpArc","turn":90,"flip":true}]}}}
|
||||
{"name":"run_command","arguments":{"command":"tool.setOption","params":{"tool":"quickPen","key":"action","value":"sharpArc"}}}
|
||||
```
|
||||
|
||||
## Registration and trim marks
|
||||
|
||||
Every document has the built-in `[Registration]` swatch (listed after None by `swatch.list`): a colour that prints on
|
||||
|
||||
@@ -628,6 +628,7 @@ since 2026-10-01.
|
||||
- **Guide row highlight (#7344):** `guide_row_highlight_stays_selected_without_hover` in `crates/ui-egui/src/panels/layers/tests.rs` checks selected guide background after the pointer leaves, with unselected guide and ordinary row controls. Guide selection, dragging and deletion are unchanged. Scores and estimates unchanged.
|
||||
|
||||
- **Recolor picker follow-up (#8031/#4028):** native Lab numeric entry, document/loaded-library swatches in the Color Picker, and Assign-row Pick from Swatches / Limit to Library menus. #4090 provided the double-click picker and #5113 the Assign sliders. Regression tests `native_lab_entry_in_color_picker` and `row_context_menu_pick_from_swatches_and_limit_to_library` exercise the fields and menu callbacks rather than writing their result state. Area score and hours unchanged.
|
||||
- **Quick Pen tool (#2660, in part):** a tool in the Pen tool's group (Alt+P, Option+P on macOS) draws straight lines, continuous arcs and sharp-corner arcs, one undo step per piece; Alt pressed and let go on its own switches the action, C flips the last sharp-corner arc, `[` and `]` change the arc size by 15°, a click on the first point closes the path, a click on an open end continues it, and Escape or Enter ends it (`path.quickPen`), as [Draw with the Quick Pen tool](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html) and [Quick Pen tool keyboard shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html) describe. The 180° default arc, its 15° steps and the side an arc bulges to are VectorCraft's own rules. Tests: tools `quickpen::tests`, engine `tests::quickpen`, ui-egui `shortcuts::alt_tap::tests` and `alt_p_chooses_the_quick_pen_and_an_alt_tap_switches_its_action`. Score and hours unchanged.
|
||||
|
||||
- **Optional compact Tools (#7234):** Window > Toolbars > Compact Tools reduces row and column spacing and the main panel's allocated width in one or two columns, docked or floating. The setting is saved with the UI state and applies to Basic, Advanced and edited main Tools layouts; the selected tool, icon size, footer controls and tool-flyout behavior are retained. Turning it off restores the existing layout, which remains the default. Named custom toolbars and flyout spacing are unchanged. Public regressions in `crates/ui-egui/tests/toolbar_compact.rs` cover the actual toolbar layout against the default control, the command and saved-state roundtrip, tool selection, flyouts, footer controls and short-window reachability. This is an optional layout choice, without a styling-parity or score claim; hours are unchanged.
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ tools, never checked side by side) isn't captured row by row.
|
||||
| Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) |
|
||||
| Each anchor snaps to Smart Guides and construction angles | done | `DrawSnap` |
|
||||
| Curvature tool: click/drag points, double-click or Alt-click for a corner, temporary Direct Selection, point conversion | partial | circular point markers without direction handles or duplicate markers, Anchor Size and Hide Edges regression-tested (#1236, in part); curve geometry: each stretch of three points follows the circle through them (handles along its tangent, chord/(3·cos²(α/2)) long, shorter in a turn tighter than 30°), open ends curving in, the same rule for the rubber band, dragged, inserted and converted points (#1236, in part); neighbours of a point dragged on an existing path keep their tangents, and modifiers requested in #975 remain |
|
||||
| Quick Pen tool: straight lines, continuous arcs and sharp-corner arcs, Alt/Option to switch action, C to flip an arc, `[` / `]` for its size, Alt+P / Option+P, close on the first point, continue from an end, Escape to end ([help page](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/draw-with-quick-pen-tool.html), [shortcuts](https://helpx.adobe.com/illustrator/web/add-and-edit-artwork/draw-and-edit-paths/quick-pen-tool-keyboard-shortcuts.html)) | partial | `path.quickPen` and the tool in `crates/tools/src/quickpen.rs`, in the Pen tool's group (#2660). Not yet: the on-canvas toolbar with its More menu, dragging a path's ends to change a line's or arc's length, Ctrl+scroll for the arc size, and editing and deleting with the tool |
|
||||
| Icon-strip flyout resizing (#5713) | done | Canvas-side edge and bottom; user size persists after reopening and workspace restore; Glyphs and Artboards pointer/cursor regression |
|
||||
| Icon-strip flyout resizing from the top (storytold/craft-libs#1094) | done | Top edge (a 4 pt band over the tab strip) and the canvas-side top corner; the bottom and the icon-column edge stay; the moved top persists after reopening and workspace restore; `an_icon_flyout_grows_upward_from_its_top_edge_and_free_corner` |
|
||||
| Graphic Styles list fills a taller panel (#2992) | done | Docked, floating or in a resized flyout, the list takes the height above the panel's footer, as the Artboards list does; outside a sized panel it stays 220 pt; `the_list_fills_a_tall_panel_above_its_footer` |
|
||||
|
||||
Reference in New Issue
Block a user