CorePlotting::ViewState
CorePlotting::ViewState
Full runtime 2D camera / viewport state. More…
#include <ViewState.hpp>
Public Attributes
| Name | |
|---|---|
| float | zoom_level_x |
| float | zoom_level_y |
| float | pan_offset_x |
| float | pan_offset_y |
| float | padding_factor |
| bool | preserve_aspect_ratio |
| BoundingBox | data_bounds |
| bool | data_bounds_valid |
| int | viewport_width |
| int | viewport_height |
Detailed Description
struct CorePlotting::ViewState;Full runtime 2D camera / viewport state.
See:
- ViewStateData — serializable subset
- toRuntimeViewState() — ViewStateData → ViewState
Combines the serializable ViewStateData (zoom, pan, data bounds) with runtime-only information (viewport pixel dimensions, validity flag, padding factor).
This struct is used to generate View and Projection matrices for the RenderableScene. It is the primary input to calculateVisibleWorldBounds(), computeMatricesFromViewState(), screenToWorld(), worldToScreen(), etc.
Widget code should store ViewStateData for serialization and promote it to ViewState at render time via toRuntimeViewState().
Public Attributes Documentation
variable zoom_level_x
float zoom_level_x = 1.0f;variable zoom_level_y
float zoom_level_y = 1.0f;variable pan_offset_x
float pan_offset_x = 0.0f;variable pan_offset_y
float pan_offset_y = 0.0f;variable padding_factor
float padding_factor = 1.1f;variable preserve_aspect_ratio
bool preserve_aspect_ratio = true;When true, calculateVisibleWorldBounds scales the visible range by the viewport aspect ratio so that world-space units look square on screen. Set to false for time-series plots where x (time) and y (trial/value) have independent units and the canvas projection does not apply aspect-ratio correction.
variable data_bounds
BoundingBox data_bounds {0.0f, 0.0f, 0.0f, 0.0f};variable data_bounds_valid
bool data_bounds_valid = false;variable viewport_width
int viewport_width = 1;variable viewport_height
int viewport_height = 1;Updated on 2026-11-13 at 20:25:42 +0000