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.
Loading...
Searching...
No Matches
donner::editor::SelectionChromeSnapshot Struct Reference

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< PathItempaths
std::vector< PathItemhoverPaths
 Transient source-hover path outlines. Drawn as soft hover chrome before selection chrome.
std::vector< Box2dpathAnchorBoxesDoc
 Anchor squares for selected SVG path vertices, sized in document units at capture time.
std::vector< PathControlLinepathControlLinesDoc
 Control-point guide lines for selected SVG paths.
std::vector< Box2dpathControlPointBoxesDoc
 Control-point squares for selected SVG paths, sized in document units at capture time.
std::optional< LockedFlashlockedFlash
 The active locked-rejection flash, or nullopt when no element is being rejected.
std::optional< LivePathPreviewlivePathPreview
 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< PathpenPreviewSegmentDoc
 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< Vector2dpenCloseAffordanceDoc
 Close-path hover affordance: when set, the first anchor at this document point is highlighted (the pointer is within closing range).
std::optional< TextCarettextCaretDoc
 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< TextBoxDragPreviewtextBoxDragPreviewDoc
 The active drag-to-create preview, or nullopt when the text tool is not dragging out a box.
std::vector< TextBaselinetextBaselinesDoc
 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< Box2daabbsDoc
 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< Box2dhoverAabbsDoc
 Bounds for the transient source-hover elements.
std::optional< Box2dmarqueeDoc
 Optional marquee rectangle in document space.
std::optional< OrientedBoxorientedBoundsDoc
 Optional oriented bounds drawn instead of axis-aligned AABBs while a rotation gesture is active.
std::vector< Box2dhandleBoxesDoc
 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

Detailed Description

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.


Class Documentation

◆ donner::editor::SelectionChromeSnapshot::OrientedBox

struct donner::editor::SelectionChromeSnapshot::OrientedBox

Four document-space corners of an oriented selection box.

Class Members
array< Vector2d, 4 > cornersDoc

◆ donner::editor::SelectionChromeSnapshot::PathItem

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.

◆ donner::editor::SelectionChromeSnapshot::PathControlLine

struct donner::editor::SelectionChromeSnapshot::PathControlLine

Document-space Bezier handle guide line for selected SVG paths.

Class Members
Vector2d anchorDoc = Vector2d() Anchor endpoint of the control line.
Vector2d controlDoc = Vector2d() Control-point endpoint of the control line.

◆ donner::editor::SelectionChromeSnapshot::LockedFlash

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.

◆ donner::editor::SelectionChromeSnapshot::LivePathPreview

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.

Member Data Documentation

◆ aabbsDoc

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.

◆ canvasFromDoc

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).

◆ handleBoxesDoc

std::vector<Box2d> donner::editor::SelectionChromeSnapshot::handleBoxesDoc

Corner resize handles in document space. Empty when there is no selection AABB.

◆ hoverAabbsDoc

std::vector<Box2d> donner::editor::SelectionChromeSnapshot::hoverAabbsDoc

Bounds for the transient source-hover elements.

◆ hoverPaths

std::vector<PathItem> donner::editor::SelectionChromeSnapshot::hoverPaths

Transient source-hover path outlines. Drawn as soft hover chrome before selection chrome.

◆ hoverStrokeWidthWorld

double donner::editor::SelectionChromeSnapshot::hoverStrokeWidthWorld = 0.0

◆ livePathPreview

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).

◆ lockedFlash

std::optional<LockedFlash> donner::editor::SelectionChromeSnapshot::lockedFlash

The active locked-rejection flash, or nullopt when no element is being rejected.

◆ marqueeDoc

std::optional<Box2d> donner::editor::SelectionChromeSnapshot::marqueeDoc

Optional marquee rectangle in document space.

◆ marqueeStrokeWidthWorld

double donner::editor::SelectionChromeSnapshot::marqueeStrokeWidthWorld = 0.0

◆ orientedBoundsDoc

std::optional<OrientedBox> donner::editor::SelectionChromeSnapshot::orientedBoundsDoc

Optional oriented bounds drawn instead of axis-aligned AABBs while a rotation gesture is active.

◆ pathAnchorBoxesDoc

std::vector<Box2d> donner::editor::SelectionChromeSnapshot::pathAnchorBoxesDoc

Anchor squares for selected SVG path vertices, sized in document units at capture time.

◆ pathControlLinesDoc

std::vector<PathControlLine> donner::editor::SelectionChromeSnapshot::pathControlLinesDoc

Control-point guide lines for selected SVG paths.

◆ pathControlPointBoxesDoc

std::vector<Box2d> donner::editor::SelectionChromeSnapshot::pathControlPointBoxesDoc

Control-point squares for selected SVG paths, sized in document units at capture time.

◆ paths

std::vector<PathItem> donner::editor::SelectionChromeSnapshot::paths

◆ penCloseAffordanceDoc

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).

◆ penPreviewSegmentDoc

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.

◆ selectionStrokeWidthWorld

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.

◆ textBaselinesDoc

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.

◆ textBoxDragPreviewDoc

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.

◆ textCaretDoc

std::optional<TextCaret> donner::editor::SelectionChromeSnapshot::textCaretDoc

The active text-editing caret, or nullopt when no text session is open.

◆ textFrameCornersDoc

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.

◆ textFrameOpacity

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.


The documentation for this struct was generated from the following file: