getVisibleArea method
Gets the visible area in graph coordinates.
Returns a rectangle representing what portion of the graph is currently visible in the given screen size. Useful for culling off-screen elements.
Parameters:
screenSize: The size of the viewport in screen pixels
Returns: A Rect in graph coordinates representing the visible area
Example:
final viewport = GraphViewport(x: 0, y: 0, zoom: 1.0);
final visible = viewport.getVisibleArea(Size(800, 600));
// Returns: Rect from (0,0) to (800,600) in graph coordinates
Implementation
Rect getVisibleArea(Size screenSize) {
final topLeft = screenToGraph(Offset.zero);
final bottomRight = screenToGraph(
Offset(screenSize.width, screenSize.height),
);
return Rect.fromPoints(topLeft, bottomRight);
}