|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
Frozen view of everything OverlayRenderer::drawChromeWithTransform would normally read off the live registry: per-element path splines transformed into document space, per-element AABBs in document space, and the optional marquee rect. More...
#include "donner/editor/OverlayRenderer.h"
Classes | |
| struct | OrientedBox |
| Four document-space corners of an oriented selection box. More... | |
| struct | PathItem |
| One entry per renderable geometry leaf in the selection (groups are expanded into their geometry descendants, same as the live path). Empty when nothing's selected. More... | |
| struct | PathControlLine |
| Document-space Bezier handle guide line for selected SVG paths. More... | |
| struct | LockedFlash |
| Transient "this element is locked, you can't select it" feedback. When present, the rejected (locked) element's outline is stroked in red with alpha scaled by intensity (1 → 0 as the flash fades). Captured from SelectTool::lockedRejectionFlash(). More... | |
| struct | LivePathPreview |
| Live document-geometry preview of the path the Pen tool is actively authoring or point-editing. Drawn beneath the selection chrome with the path's own resolved solid paint, so the presented pixels for the edited path come from the same post-flush DOM capture as the chrome - they never wait for the async raster of the new geometry. While this is present the presenter suppresses the path's stale composited layer tile (ShouldPresentCompositedTile), otherwise the old geometry would show through underneath the preview. More... | |
| struct | TextCaret |
| Text-editing caret for the in-canvas text session: document-space endpoints of the caret bar (top, bottom). More... | |
| struct | TextBoxDragPreview |
| Drag-to-create text-box preview: the live rectangle the text tool is dragging out, plus the first baseline it would create and an I-beam marker at the future caret position. Drawn as dedicated text-box chrome (crisp frame + guidance baseline + I-beam), visually distinct from the selection marquee's translucent fill + white outline. More... | |
| struct | TextBaseline |
| One baseline segment of a selected text run, in document space. More... | |
Public Attributes | |
| std::vector< PathItem > | paths |
| std::vector< PathItem > | hoverPaths |
| Transient source-hover path outlines. Drawn as soft hover chrome before selection chrome. | |
| std::vector< Vector2d > | pathAnchorPointsDoc |
| Anchor square centers for selected SVG path vertices, in document space. The square's size is resolved at draw time, in screen pixels. | |
| std::vector< PathControlLine > | pathControlLinesDoc |
| Control-point guide lines for selected SVG paths. | |
| std::vector< Vector2d > | pathControlPointsDoc |
| Control-point square centers for selected SVG paths, in document space. The square's size is resolved at draw time, in screen pixels. | |
| std::optional< LockedFlash > | lockedFlash |
| The active locked-rejection flash, or nullopt when no element is being rejected. | |
| std::optional< LivePathPreview > | livePathPreview |
| The active pen live-geometry preview, or nullopt when the Pen tool is not editing a path (or its paint is not representable as a solid preview). | |
| std::optional< Path > | penPreviewSegmentDoc |
| Rubber-band preview of the segment the Pen tool would commit at the current pointer (document space). Stroked with the control-line chrome style so the pending segment reads as guidance, not committed geometry. | |
| std::optional< Vector2d > | penCloseAffordanceDoc |
| Close-path hover affordance: when set, the first anchor at this document point is highlighted (the pointer is within closing range). | |
| std::optional< TextCaret > | textCaretDoc |
| The active text-editing caret, or nullopt when no text session is open. | |
| std::vector< std::array< Vector2d, 4 > > | textSelectionQuadsDoc |
| Highlight quads for the active text range, in document space. Each quad follows its character cell through the text element's transform. | |
| std::optional< std::array< Vector2d, 4 > > | textFrameCornersDoc |
| Session frame for the active text-editing session: local TL, TR, BR, BL corners mapped through the text's transform. An ORIENTED quad - after a rotate it stays aligned to the text's rotation, never the axis-aligned envelope. Corner resize/rotate handles are drawn at these corners. | |
| float | textFrameOpacity = 1.0f |
| Opacity of the text frame and its handles. Point text animates this value after pointer movement and typing; box text remains at 1. | |
| std::optional< TextBoxDragPreview > | textBoxDragPreviewDoc |
| The active drag-to-create preview, or nullopt when the text tool is not dragging out a box. | |
| std::vector< TextBaseline > | textBaselinesDoc |
| Baseline underlay for selected text: one document-space segment per laid-out text line, drawn beneath the selection chrome so the span of each line reads at a glance. | |
| std::vector< Box2d > | aabbsDoc |
| Per-element AABBs in document space (from SnapshotSelectionWorldBounds). Drawn with canvasFromDoc applied at compose time so they line up with the rendered content for the same DOM frame. | |
| std::vector< Box2d > | hoverAabbsDoc |
| Bounds for the transient source-hover elements. | |
| std::optional< Box2d > | marqueeDoc |
| Optional marquee rectangle in document space. | |
| std::optional< OrientedBox > | orientedBoundsDoc |
| Optional oriented bounds drawn instead of axis-aligned AABBs while a rotation gesture is active. | |
| std::vector< Vector2d > | handleAnchorsDoc |
| Corner resize handle centers in document space. Empty when there is no selection AABB. Handle squares are sized at draw time, in screen pixels. | |
| Transform2d | canvasFromDoc |
| Document-to-canvas transform the chrome is drawn with. | |
| double | devicePixelRatio = 1.0 |
| Viewport device-pixel ratio the chrome is sized for. Stroke widths and point-chrome squares are logical-pixel constants scaled by this and divided by canvasFromDoc's scale at draw time, so they hold a constant screen size at any zoom. | |
Frozen view of everything OverlayRenderer::drawChromeWithTransform would normally read off the live registry: per-element path splines transformed into document space, per-element AABBs in document space, and the optional marquee rect.
Captured once via OverlayRenderer::captureChromeSnapshot while the registry is safe to read (worker is idle), then handed to OverlayRenderer::drawChromeFromSnapshot which is race-free - it touches only the snapshot, never the registry.
Lets the chrome rasterize run while the worker is mid-render, so the editor can paint selection chrome in a frame that the worker hasn't returned a result for yet.
Every geometry member is ANCHORED in document space and every chrome SIZE (stroke widths, handle squares, path anchor/control squares) is resolved at draw time from canvasFromDoc. A snapshot is therefore drawable at any transform: the presenter re-points canvasFromDoc at the transform this frame's document pixels landed in and draws immediately, which is what makes chrome/content desync and zoom-scaled handles structurally impossible.
| struct donner::editor::SelectionChromeSnapshot::OrientedBox |
Four document-space corners of an oriented selection box.
| Class Members | ||
|---|---|---|
| array< Vector2d, 4 > | cornersDoc | |
| struct donner::editor::SelectionChromeSnapshot::PathItem |
One entry per renderable geometry leaf in the selection (groups are expanded into their geometry descendants, same as the live path). Empty when nothing's selected.
| Class Members | ||
|---|---|---|
| bool | displayNone = false | True when the selected element is hidden by display:none. The path outline still renders as an editable placeholder, but uses a dimmer stroke than visible selections. |
| Path | pathDoc | Document-space path data sampled at capture time. Keeping the path in document space lets chrome stroke width depend only on viewport scale, not on the selected element's own scale/rotation transform. |
| struct donner::editor::SelectionChromeSnapshot::PathControlLine |
| struct donner::editor::SelectionChromeSnapshot::LockedFlash |
Transient "this element is locked, you can't select it" feedback. When present, the rejected (locked) element's outline is stroked in red with alpha scaled by intensity (1 → 0 as the flash fades). Captured from SelectTool::lockedRejectionFlash().
| Class Members | ||
|---|---|---|
| float | intensity = 0.0f | Fade intensity in (0, 1]; scales the red stroke's alpha. |
| Path | pathDoc | Document-space path of the rejected (locked) element, sampled at capture time - same document-space convention as PathItem::pathDoc. |
| struct donner::editor::SelectionChromeSnapshot::LivePathPreview |
Live document-geometry preview of the path the Pen tool is actively authoring or point-editing. Drawn beneath the selection chrome with the path's own resolved solid paint, so the presented pixels for the edited path come from the same post-flush DOM capture as the chrome - they never wait for the async raster of the new geometry. While this is present the presenter suppresses the path's stale composited layer tile (ShouldPresentCompositedTile), otherwise the old geometry would show through underneath the preview.
Only solid (or none) fill/stroke paints are representable; capture skips the preview (leaving nullopt) for gradients/patterns, currentColor, or elements carrying filter/clip-path/mask, and the presenter then falls back to the normal composited raster. The preview composes above all cached tiles, which matches pen authoring (new paths are appended last in paint order).
| Class Members | ||
|---|---|---|
| Entity | entity = entt::null | Entity of the previewed path - the presenter suppresses this entity's composited layer tile while the preview is drawn. |
| optional< RGBA > | fillColor | Resolved solid fill color, or nullopt for fill: none. |
| double | fillOpacity = 1.0 | fill-opacity multiplier. |
| FillRule | fillRule = FillRule::NonZero | Fill rule for the preview fill. |
| double | opacity = 1.0 | opacity (group opacity) multiplier. |
| Path | pathDoc | Document-space path geometry sampled at capture time. |
| optional< RGBA > | strokeColor | Resolved solid stroke color, or nullopt for stroke: none. |
| double | strokeOpacity = 1.0 | stroke-opacity multiplier. |
| double | strokeWidthDoc = 1.0 | Stroke width in document units. |
| std::vector<Box2d> donner::editor::SelectionChromeSnapshot::aabbsDoc |
Per-element AABBs in document space (from SnapshotSelectionWorldBounds). Drawn with canvasFromDoc applied at compose time so they line up with the rendered content for the same DOM frame.
| Transform2d donner::editor::SelectionChromeSnapshot::canvasFromDoc |
Document-to-canvas transform the chrome is drawn with.
Capture stamps the transform it sampled geometry against, but the draw phase is free to overwrite it: every size in this snapshot is resolved from this transform at draw time, so re-pointing it at the transform the document pixels actually landed in re-places the chrome without a recapture, and without changing any on-screen chrome size.
| double donner::editor::SelectionChromeSnapshot::devicePixelRatio = 1.0 |
Viewport device-pixel ratio the chrome is sized for. Stroke widths and point-chrome squares are logical-pixel constants scaled by this and divided by canvasFromDoc's scale at draw time, so they hold a constant screen size at any zoom.
| std::vector<Vector2d> donner::editor::SelectionChromeSnapshot::handleAnchorsDoc |
Corner resize handle centers in document space. Empty when there is no selection AABB. Handle squares are sized at draw time, in screen pixels.
| std::vector<Box2d> donner::editor::SelectionChromeSnapshot::hoverAabbsDoc |
Bounds for the transient source-hover elements.
| std::vector<PathItem> donner::editor::SelectionChromeSnapshot::hoverPaths |
Transient source-hover path outlines. Drawn as soft hover chrome before selection chrome.
| std::optional<LivePathPreview> donner::editor::SelectionChromeSnapshot::livePathPreview |
The active pen live-geometry preview, or nullopt when the Pen tool is not editing a path (or its paint is not representable as a solid preview).
| std::optional<LockedFlash> donner::editor::SelectionChromeSnapshot::lockedFlash |
The active locked-rejection flash, or nullopt when no element is being rejected.
| std::optional<Box2d> donner::editor::SelectionChromeSnapshot::marqueeDoc |
Optional marquee rectangle in document space.
| std::optional<OrientedBox> donner::editor::SelectionChromeSnapshot::orientedBoundsDoc |
Optional oriented bounds drawn instead of axis-aligned AABBs while a rotation gesture is active.
| std::vector<Vector2d> donner::editor::SelectionChromeSnapshot::pathAnchorPointsDoc |
Anchor square centers for selected SVG path vertices, in document space. The square's size is resolved at draw time, in screen pixels.
| std::vector<PathControlLine> donner::editor::SelectionChromeSnapshot::pathControlLinesDoc |
Control-point guide lines for selected SVG paths.
| std::vector<Vector2d> donner::editor::SelectionChromeSnapshot::pathControlPointsDoc |
Control-point square centers for selected SVG paths, in document space. The square's size is resolved at draw time, in screen pixels.
| std::vector<PathItem> donner::editor::SelectionChromeSnapshot::paths |
| std::optional<Vector2d> donner::editor::SelectionChromeSnapshot::penCloseAffordanceDoc |
Close-path hover affordance: when set, the first anchor at this document point is highlighted (the pointer is within closing range).
| std::optional<Path> donner::editor::SelectionChromeSnapshot::penPreviewSegmentDoc |
Rubber-band preview of the segment the Pen tool would commit at the current pointer (document space). Stroked with the control-line chrome style so the pending segment reads as guidance, not committed geometry.
| std::vector<TextBaseline> donner::editor::SelectionChromeSnapshot::textBaselinesDoc |
Baseline underlay for selected text: one document-space segment per laid-out text line, drawn beneath the selection chrome so the span of each line reads at a glance.
| std::optional<TextBoxDragPreview> donner::editor::SelectionChromeSnapshot::textBoxDragPreviewDoc |
The active drag-to-create preview, or nullopt when the text tool is not dragging out a box.
| std::optional<TextCaret> donner::editor::SelectionChromeSnapshot::textCaretDoc |
The active text-editing caret, or nullopt when no text session is open.
| std::optional<std::array<Vector2d, 4> > donner::editor::SelectionChromeSnapshot::textFrameCornersDoc |
Session frame for the active text-editing session: local TL, TR, BR, BL corners mapped through the text's transform. An ORIENTED quad - after a rotate it stays aligned to the text's rotation, never the axis-aligned envelope. Corner resize/rotate handles are drawn at these corners.
| float donner::editor::SelectionChromeSnapshot::textFrameOpacity = 1.0f |
Opacity of the text frame and its handles. Point text animates this value after pointer movement and typing; box text remains at 1.
| std::vector<std::array<Vector2d, 4> > donner::editor::SelectionChromeSnapshot::textSelectionQuadsDoc |
Highlight quads for the active text range, in document space. Each quad follows its character cell through the text element's transform.