toGraphRect method

GraphRect toGraphRect(
  1. ScreenRect screenRect
)

Transforms a ScreenRect to a GraphRect.

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

Implementation

GraphRect toGraphRect(ScreenRect screenRect) {
  final topLeft = toGraph(screenRect.topLeft);
  final bottomRight = toGraph(ScreenPosition(screenRect.rect.bottomRight));
  return GraphRect.fromPoints(topLeft, bottomRight);
}