ViewportApi<T> extension

Viewport operations for NodeFlowController.

This extension provides methods for:

  • Viewport state management (get/set viewport, zoom, pan)
  • Coordinate transformations (screen ↔ graph) using typed coordinates
  • Navigation (center, fit to view, focus on nodes)
  • Visibility queries (is point/rect visible)
  • Screen and mouse position tracking

All coordinate methods use typed extension types (GraphPosition, ScreenPosition, GraphRect) to prevent accidentally mixing coordinate spaces.

on

Properties

currentPan ScreenOffset

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the current pan position of the viewport.
no setter
currentZoom double

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the current zoom level of the viewport.
no setter
mousePositionWorld GraphPosition?

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the current mouse position in graph coordinates.
no setter
selectedNodesBounds GraphRect?

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the bounding rectangle that encompasses all selected nodes in graph coordinates.
no setter
viewportExtent GraphRect

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the viewport extent as a GraphRect in graph coordinates.
no setter
viewportScreenBounds ScreenRect

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the viewport extent as a ScreenRect in screen coordinates.
no setter

Methods

centerOn(GraphOffset point) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Centers the viewport on a specific point in graph coordinates without changing zoom.
centerOnNode(String nodeId) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Centers the viewport on a specific node without changing the zoom level.
centerOnSelection() → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Centers the viewport on the center point of all selected nodes without changing zoom.
centerViewport() → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Centers the viewport on the geometric center of all nodes without changing zoom.
fitSelectedNodes() → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Adjusts the viewport to fit all selected nodes in the view with padding.
fitToView() → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Adjusts the viewport to fit all nodes in the view with padding.
getViewportCenter() GraphPosition

Available on NodeFlowController<T>, provided by the ViewportApi extension

Gets the center point of the current viewport in graph coordinates.
globalToGraph(ScreenPosition globalPosition) GraphPosition

Available on NodeFlowController<T>, provided by the ViewportApi extension

Converts a global screen position to graph coordinates.
graphToScreen(GraphPosition graphPoint) ScreenPosition

Available on NodeFlowController<T>, provided by the ViewportApi extension

Converts a graph coordinate point to screen coordinates.
isPointVisible(GraphPosition graphPoint) bool

Available on NodeFlowController<T>, provided by the ViewportApi extension

Checks if a graph coordinate point is visible in the current viewport.
isRectVisible(GraphRect graphRect) bool

Available on NodeFlowController<T>, provided by the ViewportApi extension

Checks if a graph coordinate rectangle intersects with the viewport.
panBy(ScreenOffset delta) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Pans the viewport by a delta offset.
resetViewport() → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Resets the viewport to zoom 1.0 and centers on all nodes in the graph.
screenToGraph(ScreenPosition screenPoint) GraphPosition

Available on NodeFlowController<T>, provided by the ViewportApi extension

Converts a screen coordinate point to graph coordinates.
setMousePositionWorld(GraphPosition? position) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Updates the mouse position in graph coordinates.
setScreenSize(Size size) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Sets the screen size used for viewport calculations.
setViewport(GraphViewport viewport) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Sets the viewport to a specific position and zoom level.
zoomBy(double delta) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Zoom the viewport by a delta value while maintaining the viewport center as the focal point.
zoomTo(double zoom) → void

Available on NodeFlowController<T>, provided by the ViewportApi extension

Sets the viewport zoom to a specific value.