|
| void | onMouseDown (EditorApp &editor, const Vector2d &documentPoint, MouseModifiers modifiers) override |
| | Handle a click in document space.
|
| void | onMouseMove (EditorApp &editor, const Vector2d &documentPoint, bool buttonHeld) override |
| | Handle pointer movement. While dragging the most recently placed anchor this shapes its Bezier handles; otherwise it is a no-op.
|
| void | onMouseMove (EditorApp &editor, const Vector2d &documentPoint, bool buttonHeld, MouseModifiers modifiers) |
| | Modifier-aware pointer movement. Alt/Option breaks handle symmetry so the dragged anchor becomes a corner whose incoming handle stays put while the outgoing handle follows the mouse.
|
| void | onMouseUp (EditorApp &editor, const Vector2d &documentPoint) override |
| | Handle mouse release. Commits the dragged anchor's handles if it moved.
|
|
void | cancel (EditorApp &editor) |
| | Cancel the in-progress path. Restores the document and undo stack to the state before the pen session began - Escape / cancel never leaves a partial path behind.
|
|
void | cancel () |
| | Cancel the in-progress path without touching the document. Used when no editor is available (e.g. tool destruction); does not roll back the DOM.
|
| bool | commitOpenPath (EditorApp &editor) |
| | Commit the in-progress open path without closing it (no trailing Z). Triggered by Enter / double-click and by tool switches. Finalizes the path as one undoable command and clears the draft. No-op when not drafting or when the path has fewer than two anchors.
|
| bool | removeLastAnchor (EditorApp &editor) |
| | Remove the most recently placed anchor from the creation draft (Backspace/Delete while drafting). Removing the only remaining anchor discards the draft entirely. No-op during an active drag or a point-edit session on a committed path.
|
| std::optional< Path > | previewSegmentPath (const Vector2d &documentPoint, const MouseModifiers &modifiers) const |
| | Live rubber-band preview of the segment a click at documentPoint would commit: from the draft's last anchor (honoring its outgoing handle and the Shift 45-degree constraint) to the pointer - or to the first anchor when the pointer is within closing range. Returns nullopt while not drafting, mid-drag, in a point-edit session, or after close.
|
| bool | wouldCloseAt (const Vector2d &documentPoint, const MouseModifiers &modifiers) const |
| | True when a click at documentPoint would close the active contour (used for the close-path hover affordance).
|
|
const Vector2d & | draftStartPoint () const |
| | First anchor of the active draft (the close-path target).
|
|
bool | isDrafting () const |
| | Whether the tool is currently appending to or point-editing a path.
|
|
bool | isDraggingAnchor () const |
| | Whether a mouse drag is currently shaping a path point - the most recently placed anchor's handles, an existing anchor, or an existing control point.
|
|
const std::string & | activePathData () const |
| | Current path data for tests and UI diagnostics.
|
|
| Tool (const Tool &)=delete |
|
Tool & | operator= (const Tool &)=delete |
|
| Tool (Tool &&)=delete |
|
Tool & | operator= (Tool &&)=delete |
Click-to-place path authoring tool with direct point editing.
Supports polyline creation, click-drag smooth Bezier anchors with Alt/Option corner-break, shift-constrained points (45-degree increments), continuing a selected open <path>, closing an active path by clicking near its first point, and committing an open path with Enter / double-click. Every finalized pen session records exactly one undoable command.
The visible path-point chrome is directly editable: anchors and control points of the active draft - or of a selected, already-committed <path>
- are hit targets. Dragging a control point reshapes that handle (aligned coupling on smooth anchors; Alt/Option breaks the coupling; Shift constrains the handle angle to 45-degree increments), dragging an anchor moves it together with its handles, clicking the draft's last anchor retracts its outgoing handle so the next segment starts straight, Alt/Option-clicking an anchor toggles it between corner and smooth, clicking the open endpoint of a selected path resumes drafting from it, and Cmd/Ctrl restricts the gesture to point editing so a miss never places an anchor.