Owns viewport/input state for the render pane: zoom/pan, pending click dispatch, and frame timing history.
More...
#include "donner/editor/ViewportInteractionController.h"
|
|
ViewportState & | viewport () |
| | Return the viewport used for render-pane layout and pointer transforms.
|
|
const ViewportState & | viewport () const |
| | Return the viewport used for render-pane layout and pointer transforms.
|
|
FrameHistory & | frameHistory () |
| | Return the bounded history of frame timings and memory samples.
|
|
const FrameHistory & | frameHistory () const |
| | Return the bounded history of frame timings and memory samples.
|
| void | noteFrameDelta (float deltaMs) |
| | Append one UI-frame duration to the timing history.
|
| void | updatePaneLayout (const Vector2d &paneOrigin, const Vector2d &paneSize, const std::optional< Box2d > &documentViewBox, bool preservePaneCenterDocumentPoint=false) |
| | Update pane geometry and optionally retain the document point at its center.
|
| void | updateDevicePixelRatio (double devicePixelRatio) |
| | Update the physical-to-logical pixel ratio used by the viewport.
|
| bool | resetToActualSize () |
| | Reset the viewport to 100%.
|
| bool | zoomToFit (const Box2d &fitScreenRect) |
| | Fit the whole document into the unobstructed canvas area.
|
| bool | resetToInitialView (const Box2d &fitScreenRect) |
| | Show a newly opened document at 100%, or fitted when it is larger than the canvas area.
|
| 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 |
| | Return whether a mouse-pan gesture is in progress.
|
| 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) |
| | Retain a document-space click until it can be dispatched.
|
|
const std::optional< PendingClick > & | pendingClick () const |
| | Return the buffered click, if one is waiting.
|
|
void | clearPendingClick () |
| | Discard the buffered click.
|
Owns viewport/input state for the render pane: zoom/pan, pending click dispatch, and frame timing history.
◆ applyZoom()
| bool donner::editor::ViewportInteractionController::applyZoom |
( |
double | factor, |
|
|
const Vector2d & | focalScreen ) |
|
nodiscard |
Apply a multiplicative zoom around a screen-space focal point.
- Parameters
-
| factor | Zoom multiplier. |
| focalScreen | Screen-space point that remains anchored. |
- Returns
- True if the viewport mapping changed.
◆ bufferPendingClick()
| void donner::editor::ViewportInteractionController::bufferPendingClick |
( |
const Vector2d & | documentPoint, |
|
|
MouseModifiers | modifiers ) |
Retain a document-space click until it can be dispatched.
- Parameters
-
| documentPoint | Click position in document coordinates. |
| modifiers | Keyboard modifiers captured with the click. |
◆ consumeScrollEvents()
Consume queued trackpad/wheel events.
- Returns
- Viewport mutation summary for the consumed events.
◆ noteFrameDelta()
| void donner::editor::ViewportInteractionController::noteFrameDelta |
( |
float | deltaMs | ) |
|
|
inline |
Append one UI-frame duration to the timing history.
- Parameters
-
| deltaMs | Frame duration in milliseconds. |
◆ resetToActualSize()
| bool donner::editor::ViewportInteractionController::resetToActualSize |
( |
| ) |
|
|
nodiscard |
Reset the viewport to 100%.
- Returns
- True if the viewport mapping changed.
◆ resetToInitialView()
| bool donner::editor::ViewportInteractionController::resetToInitialView |
( |
const Box2d & | fitScreenRect | ) |
|
|
nodiscard |
Show a newly opened document at 100%, or fitted when it is larger than the canvas area.
- Parameters
-
| fitScreenRect | Unobstructed canvas area, in screen pixels. |
- Returns
- True if the viewport mapping changed.
◆ updateDevicePixelRatio()
| void donner::editor::ViewportInteractionController::updateDevicePixelRatio |
( |
double | devicePixelRatio | ) |
|
Update the physical-to-logical pixel ratio used by the viewport.
- Parameters
-
| devicePixelRatio | Current display pixel ratio. |
◆ updatePaneLayout()
| void donner::editor::ViewportInteractionController::updatePaneLayout |
( |
const Vector2d & | paneOrigin, |
|
|
const Vector2d & | paneSize, |
|
|
const std::optional< Box2d > & | documentViewBox, |
|
|
bool | preservePaneCenterDocumentPoint = false ) |
Update pane geometry and optionally retain the document point at its center.
- Parameters
-
| paneOrigin | Pane origin in logical screen pixels. |
| paneSize | Pane size in logical pixels. |
| documentViewBox | New document viewBox, or no value to preserve the current document geometry. |
| preservePaneCenterDocumentPoint | Whether layout changes keep the center document point anchored. |
◆ 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.
◆ zoomToFit()
| bool donner::editor::ViewportInteractionController::zoomToFit |
( |
const Box2d & | fitScreenRect | ) |
|
|
nodiscard |
Fit the whole document into the unobstructed canvas area.
- Parameters
-
| fitScreenRect | Unobstructed canvas area, in screen pixels. |
- Returns
- True if the viewport mapping changed.
The documentation for this class was generated from the following file: