toScreenRect method

ScreenRect toScreenRect(
  1. GraphRect graphRect
)

Transforms a GraphRect to a ScreenRect.

Converts a rectangle in graph coordinates to screen coordinates, applying pan and zoom transformations.

Example:

final viewport = GraphViewport(x: 100, y: 50, zoom: 2.0);
final nodeBounds = GraphRect.fromLTWH(0, 0, 50, 50);
final screenBounds = viewport.toScreenRect(nodeBounds);

Implementation

ScreenRect toScreenRect(GraphRect graphRect) {
  final topLeft = toScreen(graphRect.topLeft);
  final bottomRight = toScreen(graphRect.bottomRight);
  return ScreenRect.fromPoints(topLeft, bottomRight);
}