Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::editor::CompositedPresentation Class Reference

Tracks composited presentation state across selection, drag, and release. More...

#include "donner/editor/CompositedPresentation.h"

Classes

struct  DiagnosticsSnapshot
 Immutable-by-copy presentation diagnostics for tests and MCP reporting. More...

Public Types

enum class  Phase {
  NoCache ,
  Cached ,
  SettlingForRender ,
  WaitingForChromeRefresh
}
 Closed presentation phase exposed through diagnostics.

Public Member Functions

DiagnosticsSnapshot diagnostics () const
 Return a copied diagnostic snapshot of the current presentation state.
bool hasCachedTextures () const
 Returns true when cached composited textures are available for presentation.
bool isWaitingForFullRender () const
 Returns true while a released drag waits for a fresh full render.
bool isWaitingForChromeRefresh () const
 Returns true while a composited settle waits for refreshed overlay chrome.
std::optional< SelectTool::ActiveDragPreviewactivePreviewForPresentation (const std::optional< SelectTool::ActiveDragPreview > &activePreview) const
 Returns the active preview that should drive presenter-side tile transforms.
bool needsCompositedLayerCapture (const std::optional< SelectTool::ActiveDragPreview > &activePreview, std::uint64_t, const Vector2i &) const
 Returns true when an active drag needs a fresh composited capture.
bool needsSettledSelectionRefresh (Entity selectedEntity, std::uint64_t currentVersion) const
 Returns true when a released drag should request a settled composited refresh.
bool shouldPrewarm (Entity selectedEntity, const std::vector< Entity > &selectedExtraEntities, std::uint64_t currentVersion, const Vector2i &currentCanvasSize, bool dragActive) const
 Returns true when selection should trigger an async prewarm capture.
void noteCachedTextures (Entity entity, std::uint64_t version, const Vector2i &canvasSize, std::optional< SelectTool::ActiveDragPreview > representedPreview=std::nullopt)
 Mark cached composited textures as available for the given entity/version/canvas size.
bool discardCachedTexturesForEntity (Entity entity)
 Drop cached presentation state for entity.
void noteChromeRefreshCompleted (std::uint64_t refreshedVersion)
 Finish the settle handoff once overlay chrome and cached AABBs have refreshed to match the settled document version. Only then is it safe to drop the old drag offset.
void beginSettling (const std::optional< SelectTool::ActiveDragPreview > &preview, std::uint64_t targetVersion)
 Begin the post-release settling phase, keeping the last composited presentation alive.
void noteFullRenderLanded (std::uint64_t landedVersion)
 End the settling phase once a fresh full render has landed.
std::optional< SelectTool::ActiveDragPreviewpresentationPreview (const std::optional< SelectTool::ActiveDragPreview > &activePreview) const
 Returns the drag preview that should currently be displayed, if any.
void clearSettlingIfSelectionChanged (Entity selectedEntity, bool dragActive)
 Preserve in-flight settling across temporary selection remaps.

Detailed Description

Tracks composited presentation state across selection, drag, and release.


Class Documentation

◆ donner::editor::CompositedPresentation::DiagnosticsSnapshot

struct donner::editor::CompositedPresentation::DiagnosticsSnapshot

Immutable-by-copy presentation diagnostics for tests and MCP reporting.

Collaboration diagram for donner::editor::CompositedPresentation::DiagnosticsSnapshot:
[legend]
Class Members
Vector2i cachedCanvasSize = Vector2i::Zero()
Entity cachedEntity = entt::null
uint64_t cachedVersion = 0
uint64_t chromeRefreshTargetVersion = 0
bool hasCachedTextures = false
Phase phase = Phase::NoCache
optional< ActiveDragPreview > settlingPreview
uint64_t settlingTargetVersion = 0
bool waitingForChromeRefresh = false
bool waitingForFullRender = false

Member Function Documentation

◆ activePreviewForPresentation()

std::optional< SelectTool::ActiveDragPreview > donner::editor::CompositedPresentation::activePreviewForPresentation ( const std::optional< SelectTool::ActiveDragPreview > & activePreview) const
inlinenodiscard

Returns the active preview that should drive presenter-side tile transforms.

During a live drag this is the tool's active preview. After mouse-up, SelectTool::activeDragPreview is empty, but the render pane must keep presenting the released transform until a settled render replaces the cached tiles.

◆ clearSettlingIfSelectionChanged()

void donner::editor::CompositedPresentation::clearSettlingIfSelectionChanged ( Entity selectedEntity,
bool dragActive )
inline

Preserve in-flight settling across temporary selection remaps.

After ReplaceDocument, entity handles are invalidated and the selection is remapped to new entities. Cached composited textures stay live as the visible document image until the next render atomically replaces them via noteCachedTextures().

◆ discardCachedTexturesForEntity()

bool donner::editor::CompositedPresentation::discardCachedTexturesForEntity ( Entity entity)
inline

Drop cached presentation state for entity.

This is intentionally explicit instead of tied to selection changes. Normal deselection keeps the cached document image alive until the next render replaces it; a selected element becoming display:none is different because the cached promoted tile would keep rendering content that the live DOM has already hidden.

Parameters
entityEntity whose cached presentation should be discarded.
Returns
true if cached state matched entity and was cleared.

◆ noteFullRenderLanded()

void donner::editor::CompositedPresentation::noteFullRenderLanded ( std::uint64_t landedVersion)
inline

End the settling phase once a fresh full render has landed.

This function only handles settling-state bookkeeping; cached tiles remain live until a fresh upload replaces them or the document is reset.


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