screenToGraph method
Converts a screen coordinate point to graph coordinates.
Use this to transform mouse/touch positions or screen coordinates back to graph space, taking into account the current viewport position and zoom level.
Parameters:
screenPoint: The point in screen coordinates
Returns the corresponding point in graph coordinates as GraphPosition.
Example:
final mousePos = ScreenPosition(event.localPosition);
final graphPos = controller.screenToGraph(mousePos);
Implementation
GraphPosition screenToGraph(ScreenPosition screenPoint) {
return _viewport.value.toGraph(screenPoint);
}