viewportExtent property
GraphRect
get
viewportExtent
Gets the viewport extent as a GraphRect in graph coordinates.
This represents the visible area of the graph in world space. Use this to determine which nodes or elements are currently visible.
Returns a GraphRect representing the visible portion of the graph.
Implementation
GraphRect get viewportExtent {
final vp = _viewport.value;
final size = _screenSize.value;
// Convert screen bounds to world coordinates
final left = -vp.x / vp.zoom;
final top = -vp.y / vp.zoom;
final right = (size.width - vp.x) / vp.zoom;
final bottom = (size.height - vp.y) / vp.zoom;
return GraphRect(Rect.fromLTRB(left, top, right, bottom));
}