Interface IReadOnlyViewportState
Read-only viewport state for observing pan/zoom changes.
The viewport defines the visible area of the infinite canvas and provides coordinate transformation between canvas space (where elements live) and screen space (what the user sees).
Inspired by:
- react-diagrams: CanvasModel with offsetX, offsetY, zoom
- Konva.js: Stage with scale, position properties
- mxGraph: mxGraphView with scale and translate
public interface IReadOnlyViewportState : ICoordinateTransformer
- Inherited Members
- Extension Methods
Properties
ViewSize
The visible size of the viewport in screen coordinates (pixels).
Size ViewSize { get; }
Property Value
Methods
GetVisibleCanvasRect()
Gets the currently visible area in canvas coordinates.
This is the inverse transform of the screen bounds. Use this to determine which graph elements are potentially visible for culling/virtualization.
Rect GetVisibleCanvasRect()
Returns
- Rect
A rectangle in canvas coordinates representing the visible area. Returns Empty if ViewSize is not set.
Events
ViewportChanged
Event raised when any viewport property changes (zoom, offset, or view size).
Subscribers should invalidate their display or recalculate visibility when this event fires.
event EventHandler? ViewportChanged