|
|
Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
|
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< Box2d > | pathAnchorBoxesDoc |
| Anchor squares for selected SVG path vertices, sized in document units at capture time. | |
| std::vector< PathControlLine > | pathControlLinesDoc |
| Control-point guide lines for selected SVG paths. | |
| std::vector< Box2d > | pathControlPointBoxesDoc |
| Control-point squares for selected SVG paths, sized in document units at capture time. | |
| 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::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< Box2d > | handleBoxesDoc |
| Corner resize handles in document space. Empty when there is no selection AABB. | |
| Transform2d | canvasFromDoc |
| canvasFromDoc at capture time. The draw phase needs this for drawing AABBs and the marquee (both live in doc space). | |
| double | selectionStrokeWidthWorld = 0.0 |
| World-space stroke widths derived from the snapshot's canvasFromDoc scale, pre-computed so the draw phase doesn't have to recompute anything that depends on registry state. | |
| double | hoverStrokeWidthWorld = 0.0 |
| double | marqueeStrokeWidthWorld = 0.0 |
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.
Design doc 0033 §M7. 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.
| 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 |
canvasFromDoc at capture time. The draw phase needs this for drawing AABBs and the marquee (both live in doc space).
| std::vector<Box2d> donner::editor::SelectionChromeSnapshot::handleBoxesDoc |
Corner resize handles in document space. Empty when there is no selection AABB.
| 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.
| double donner::editor::SelectionChromeSnapshot::hoverStrokeWidthWorld = 0.0 |
| 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.
| double donner::editor::SelectionChromeSnapshot::marqueeStrokeWidthWorld = 0.0 |
| std::optional<OrientedBox> donner::editor::SelectionChromeSnapshot::orientedBoundsDoc |
Optional oriented bounds drawn instead of axis-aligned AABBs while a rotation gesture is active.
| std::vector<Box2d> donner::editor::SelectionChromeSnapshot::pathAnchorBoxesDoc |
Anchor squares for selected SVG path vertices, sized in document units at capture time.
| std::vector<PathControlLine> donner::editor::SelectionChromeSnapshot::pathControlLinesDoc |
Control-point guide lines for selected SVG paths.
| std::vector<Box2d> donner::editor::SelectionChromeSnapshot::pathControlPointBoxesDoc |
Control-point squares for selected SVG paths, sized in document units at capture time.
| 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.
| double donner::editor::SelectionChromeSnapshot::selectionStrokeWidthWorld = 0.0 |
World-space stroke widths derived from the snapshot's canvasFromDoc scale, pre-computed so the draw phase doesn't have to recompute anything that depends on registry state.
| 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.