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

LayersPanel is the user-facing Layers panel UI. It renders the flat LayerTreeModel row list as an ImGui tree with disclosure chevrons, per-row preview thumbnails, and selection that stays synchronized with the canvas and source panes. More...

#include <cstdint>
#include <functional>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
#include "donner/base/Vector2.h"
#include "donner/css/Color.h"
#include "donner/editor/EditorApp.h"
#include "donner/editor/ImGuiIncludes.h"
#include "donner/editor/LayerTreeModel.h"
#include "donner/svg/renderer/RendererInterface.h"
Include dependency graph for LayersPanel.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::LayersLockedRejectionFlash
 Current "this element is locked, you can't select it" flash fed into the Layers panel so the rejected element's row flashes red in sync with the canvas outline flash. Mirrors OverlayRenderer.h's LockedRejectionFlashInput but is kept local so LayersPanel stays decoupled from SelectTool / OverlayRenderer; EditorShell maps the tool's flash into this struct. More...
class  donner::editor::LayersPanel
 ImGui Layers panel backed by a LayerTreeModel snapshot. More...
struct  donner::editor::LayersPanel::ThumbnailTexture
 Maps a per-row rendered thumbnail bitmap to an ImGui texture handle for display. The editor shell supplies an implementation backed by GlTextureCache (the same Donner-bitmap -> GL/WGPU texture path the render pane uses); when null (e.g. in headless unit tests) the panel falls back to the deterministic swatch. Donner renders the thumbnail pixels; ImGui only blits the resulting texture - see CLAUDE.md "No Rendering Vector Graphics With ImGui". More...
struct  donner::editor::LayersPanel::IconTexture
 Maps a static layer-affordance icon bitmap to an ImGui texture handle for display. The icon bitmaps are rendered from embedded Bootstrap SVG resources through Donner; ImGui only receives the final raster texture for the image button. More...
struct  donner::editor::LayersPanel::ThumbnailRefreshStats
 Diagnostics for the most recent thumbnail refresh. More...
struct  donner::editor::LayersPanel::ClickModifiers
 Modifier state for a row click. Mirrors the ImGui click path so tests can drive selection without a live ImGui frame. More...

Namespaces

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

Detailed Description

LayersPanel is the user-facing Layers panel UI. It renders the flat LayerTreeModel row list as an ImGui tree with disclosure chevrons, per-row preview thumbnails, and selection that stays synchronized with the canvas and source panes.

Selection requests flow out through the live EditorApp (setSelection, toggleInSelection), mirroring SidebarPresenter's discipline: when the async renderer owns the document, clicks are dropped rather than racing the worker.

The panel deliberately exposes non-ImGui testing seams (rows, handleRowClick, hasThumbnailOrSwatch, rowFallbackSwatch, rowThumbnail) so the selection logic and preview guarantees can be exercised without an ImGui frame.


Class Documentation

◆ donner::editor::LayersPanel::ThumbnailTexture

struct donner::editor::LayersPanel::ThumbnailTexture

Maps a per-row rendered thumbnail bitmap to an ImGui texture handle for display. The editor shell supplies an implementation backed by GlTextureCache (the same Donner-bitmap -> GL/WGPU texture path the render pane uses); when null (e.g. in headless unit tests) the panel falls back to the deterministic swatch. Donner renders the thumbnail pixels; ImGui only blits the resulting texture - see CLAUDE.md "No Rendering Vector Graphics With ImGui".

Parameters
stableIdStable id of the row whose thumbnail is being uploaded.
bitmapThe Donner-rendered RGBA thumbnail bitmap.
Returns
An ImGui texture handle plus the valid payload UV range, or an empty texture if upload failed.
Class Members
ImTextureID texture = 0 ImGui texture handle.
Vector2d uvBottomRight = Vector2d(1.0, 1.0) Bottom-right valid payload UV.

◆ donner::editor::LayersPanel::IconTexture

struct donner::editor::LayersPanel::IconTexture

Maps a static layer-affordance icon bitmap to an ImGui texture handle for display. The icon bitmaps are rendered from embedded Bootstrap SVG resources through Donner; ImGui only receives the final raster texture for the image button.

Parameters
stableIdStable id of the static icon resource being uploaded.
bitmapThe Donner-rendered RGBA icon bitmap.
Returns
An ImGui texture handle plus the valid payload UV range, or an empty texture if upload failed.
Class Members
ImTextureID texture = 0 ImGui texture handle.
Vector2d uvBottomRight = Vector2d(1.0, 1.0) Bottom-right valid payload UV.

◆ donner::editor::LayersPanel::ThumbnailRefreshStats

struct donner::editor::LayersPanel::ThumbnailRefreshStats

Diagnostics for the most recent thumbnail refresh.

Class Members
uint64_t documentFrameVersion = 0 Document frame version observed during the refresh.
size_t renderedCount = 0 Number of row thumbnails rasterized through Donner during this refresh.
double renderMs = 0.0 Wall time spent in thumbnail rasterization work.
size_t reusedCount = 0 Number of cached row thumbnails reused during this refresh.
size_t rowCount = 0 Visible row count after refreshing the model.
size_t skippedForCanvasInvalidationCount = 0 Number of rows skipped because the canvas render tree had pending invalidation.

◆ donner::editor::LayersPanel::ClickModifiers

struct donner::editor::LayersPanel::ClickModifiers

Modifier state for a row click. Mirrors the ImGui click path so tests can drive selection without a live ImGui frame.

Class Members
bool ctrl = false Ctrl/Cmd toggles the clicked row in the selection.
bool shift = false Shift extends selection in visible row order.