Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
SelectionAabb.h File Reference
#include <cstdint>
#include <limits>
#include <span>
#include <vector>
#include "donner/base/Box.h"
#include "donner/svg/SVGElement.h"
#include "donner/svg/SVGGeometryElement.h"
Include dependency graph for SelectionAabb.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::SelectionBoundsCache
 Pending/displayed selection AABBs tracked across document-version changes. More...

Namespaces

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

Functions

std::vector< svg::SVGGeometryElementdonner::editor::CollectRenderableGeometry (const svg::SVGElement &root)
 Collect every renderable svg::SVGGeometryElement in root's subtree (including root itself if it is geometry). Skips container subtrees that are not part of the visual tree — defs, clipPath, mask, filter, pattern, gradients, symbol, marker, style.
std::vector< Box2ddonner::editor::SnapshotSelectionWorldBounds (std::span< const svg::SVGElement > selection)
 Snapshot world-space bounds for every selected element that has renderable geometry. Elements that are themselves geometry contribute their own bounds; group-like elements contribute the union of their renderable geometry descendants. Elements with no renderable geometry produce no entry.
void donner::editor::PromoteSelectionBoundsIfReady (SelectionBoundsCache &cache, std::uint64_t displayedDocVersion)
 Promote pending bounds when the corresponding document bitmap is visible.
void donner::editor::RefreshSelectionBoundsCache (SelectionBoundsCache &cache, std::span< const svg::SVGElement > selection, std::uint64_t currentDocVersion, std::uint64_t displayedDocVersion)
 Refresh the cache from the current selection and document version.

Function Documentation

◆ CollectRenderableGeometry()

std::vector< svg::SVGGeometryElement > donner::editor::CollectRenderableGeometry ( const svg::SVGElement & root)
nodiscard

Collect every renderable svg::SVGGeometryElement in root's subtree (including root itself if it is geometry). Skips container subtrees that are not part of the visual tree — defs, clipPath, mask, filter, pattern, gradients, symbol, marker, style.

Used by the editor to expand a group selection ("I picked this `<g filter>`") into the set of leaves whose outlines + world bounds should drive selection chrome.

◆ SnapshotSelectionWorldBounds()

std::vector< Box2d > donner::editor::SnapshotSelectionWorldBounds ( std::span< const svg::SVGElement > selection)
nodiscard

Snapshot world-space bounds for every selected element that has renderable geometry. Elements that are themselves geometry contribute their own bounds; group-like elements contribute the union of their renderable geometry descendants. Elements with no renderable geometry produce no entry.

Parameters
selectionCurrent selection handles.
Returns
Document-space AABBs in selection order (one per selected element that has geometry).