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::ViewportInteractionController Class Reference

Owns viewport/input state for the render pane: zoom/pan, pending click dispatch, and frame timing history. More...

#include "donner/editor/ViewportInteractionController.h"

Public Member Functions

ViewportStateviewport ()
const ViewportStateviewport () const
FrameHistoryframeHistory ()
const FrameHistoryframeHistory () const
void noteFrameDelta (float deltaMs)
void updatePaneLayout (const Vector2d &paneOrigin, const Vector2d &paneSize, const std::optional< Box2d > &documentViewBox, bool preservePaneCenterDocumentPoint=false)
void updateDevicePixelRatio (double devicePixelRatio)
bool resetToActualSize ()
 Reset the viewport to 100%.
bool applyZoom (double factor, const Vector2d &focalScreen)
 Apply a multiplicative zoom around a screen-space focal point.
bool updatePanState (bool paneHovered, bool spaceHeld, bool middleDown, bool leftDown, const ImVec2 &mousePosition)
 Update mouse-drag pan state.
bool panning () const
ScrollConsumptionResult consumeScrollEvents (std::vector< RenderPaneScrollEvent > &events, const Box2d &paneRect, bool modalCapturingInput, double wheelZoomStep, double panPixelsPerScrollUnit)
 Consume queued trackpad/wheel events.
void bufferPendingClick (const Vector2d &documentPoint, MouseModifiers modifiers)
const std::optional< PendingClick > & pendingClick () const
void clearPendingClick ()

Detailed Description

Owns viewport/input state for the render pane: zoom/pan, pending click dispatch, and frame timing history.

Member Function Documentation

◆ applyZoom()

bool donner::editor::ViewportInteractionController::applyZoom ( double factor,
const Vector2d & focalScreen )
nodiscard

Apply a multiplicative zoom around a screen-space focal point.

Parameters
factorZoom multiplier.
focalScreenScreen-space point that remains anchored.
Returns
True if the viewport mapping changed.

◆ consumeScrollEvents()

ScrollConsumptionResult donner::editor::ViewportInteractionController::consumeScrollEvents ( std::vector< RenderPaneScrollEvent > & events,
const Box2d & paneRect,
bool modalCapturingInput,
double wheelZoomStep,
double panPixelsPerScrollUnit )
nodiscard

Consume queued trackpad/wheel events.

Returns
Viewport mutation summary for the consumed events.

◆ resetToActualSize()

bool donner::editor::ViewportInteractionController::resetToActualSize ( )
nodiscard

Reset the viewport to 100%.

Returns
True if the viewport mapping changed.

◆ updatePanState()

bool donner::editor::ViewportInteractionController::updatePanState ( bool paneHovered,
bool spaceHeld,
bool middleDown,
bool leftDown,
const ImVec2 & mousePosition )
nodiscard

Update mouse-drag pan state.

Returns
True if the viewport mapping changed.

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