Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
PenTool.h File Reference

Release-quality path authoring tool. PenTool creates source-backed <path> elements from document-space clicks: a plain click places a line anchor (M/L), a click-drag places a smooth Bezier anchor (C) whose outgoing handle follows the mouse while the incoming handle mirrors it through the anchor, and Alt/Option during the drag breaks that symmetry to author a corner with mismatched handles. Shift constrains the next anchor to 0/45/90 degrees from the previous one, clicking near the first anchor closes the contour with Z (dragging on close shapes the closing anchor's handles), and the whole pen session collapses into a single undoable command on finalize (close, Enter/double-click or Escape commit, or a tool switch). More...

#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
#include "donner/base/Path.h"
#include "donner/base/Vector2.h"
#include "donner/editor/Tool.h"
#include "donner/svg/SVGPathElement.h"
Include dependency graph for PenTool.h:
This graph shows which files directly or indirectly include this file:

Classes

class  donner::editor::PenTool
 Click-to-place path authoring tool with direct point editing. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Enumerations

enum class  donner::editor::PenHoverIntent : std::uint8_t {
  PlaceAnchor ,
  ClosePath ,
  DragAnchor ,
  InsertAnchor
}
 What a pen-tool click at the hovered point would do. Drives the contextual pointer cursor so the user can tell "this click edits the path I am pointing at" from "this click adds a point". More...

Detailed Description

Release-quality path authoring tool. PenTool creates source-backed <path> elements from document-space clicks: a plain click places a line anchor (M/L), a click-drag places a smooth Bezier anchor (C) whose outgoing handle follows the mouse while the incoming handle mirrors it through the anchor, and Alt/Option during the drag breaks that symmetry to author a corner with mismatched handles. Shift constrains the next anchor to 0/45/90 degrees from the previous one, clicking near the first anchor closes the contour with Z (dragging on close shapes the closing anchor's handles), and the whole pen session collapses into a single undoable command on finalize (close, Enter/double-click or Escape commit, or a tool switch).

Enumeration Type Documentation

◆ PenHoverIntent

enum class donner::editor::PenHoverIntent : std::uint8_t
strong

What a pen-tool click at the hovered point would do. Drives the contextual pointer cursor so the user can tell "this click edits the path I am pointing at" from "this click adds a point".

Enumerator
PlaceAnchor 

Start a path, or append an anchor to the one being drafted.

ClosePath 

Close the active contour on its first anchor.

DragAnchor 

Grab the anchor or control point under the pointer and move it.

InsertAnchor 

Split the hovered segment with a new anchor, preserving the shape.