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
LayerTreeModel.h File Reference

LayerTreeModel is the pure, ImGui-free, value-snapshot model behind the user-facing Layers panel. More...

#include <cstdint>
#include <string>
#include <unordered_set>
#include <vector>
#include "donner/editor/EditorApp.h"
#include "donner/svg/SVGElement.h"
Include dependency graph for LayerTreeModel.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::LayerTreeRow
 One flattened row of the Layers tree. The list is flat (not nested); nesting is conveyed by depth. Rows for descendants of a collapsed group are omitted, but hasChildren is still set on collapsed groups so the disclosure chevron renders. More...
class  donner::editor::LayerTreeModel
 Builds and owns the flat Layers row list. Selection is mirrored in from EditorApp on every refresh; selection requests flow back out through LayersPanel (this model is read-only with respect to the document). 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::LayerRowKind : std::uint8_t {
  Root ,
  Group ,
  CompoundPath ,
  Shape ,
  Other
}
 Classification of an editor layer row. Drives the row icon/affordances and is asserted by layer_tree_model_tests. More...

Detailed Description

LayerTreeModel is the pure, ImGui-free, value-snapshot model behind the user-facing Layers panel.

It walks the editable SVG light tree and produces a flat list of LayerTreeRows - one per editor-visible layer (document root, groups, subgroups, and renderable leaf shapes). Non-rendered resource subtrees (<defs>, gradients, filters, clip paths, masks, patterns, markers, symbols, <style>, <title>, <desc>, <metadata>) are excluded.

The model deliberately knows nothing about ImGui or rendering backends; it is a DOM-shaped snapshot that LayersPanel renders and that tests can assert against directly. Expansion state persists across refreshes keyed by a stable per-element id so collapsing/expanding survives idle snapshot refreshes and document mutations that don't rebuild the tree.

Enumeration Type Documentation

◆ LayerRowKind

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

Classification of an editor layer row. Drives the row icon/affordances and is asserted by layer_tree_model_tests.

Enumerator
Root 

The document root <svg>.

Group 

A grouping container (<g> or nested <svg>) with renderable descendants.

CompoundPath 

A <path> with more than one subpath (kept as a single leaf row).

Shape 

A renderable leaf shape (path/rect/circle/ellipse/line/poly*‍/text/image/use).

Other 

Catch-all for renderable elements that don't fit the buckets above.