isRectVisible method
Checks if a rectangle is visible in the current viewport.
Determines whether any part of the given GraphRect is visible within the screen area. Used for visibility culling and optimization.
Parameters:
rect: Rectangle in graph coordinates to checkscreenSize: The size of the viewport in screen pixels
Returns: true if the rectangle overlaps the visible area
Example:
final viewport = GraphViewport(x: 0, y: 0, zoom: 1.0);
final nodeRect = GraphRect.fromLTWH(100, 100, 50, 50);
final isVisible = viewport.isRectVisible(nodeRect, Size(800, 600));
Implementation
bool isRectVisible(GraphRect rect, Size screenSize) {
final visibleArea = getVisibleArea(screenSize);
return visibleArea.overlaps(rect);
}