screenToGraphDelta method

Offset screenToGraphDelta(
  1. Offset screenDelta
)

Transforms a screen delta to graph delta (without translation).

Converts a change in screen position to the corresponding change in graph coordinates. Unlike screenToGraph, this only applies zoom scaling, not pan translation.

Useful for converting mouse drag distances to graph movement.

Example:

final viewport = GraphViewport(zoom: 2.0);
final graphDelta = viewport.screenToGraphDelta(Offset(100, 50));
// Returns: Offset(50, 25) in graph units

Implementation

Offset screenToGraphDelta(Offset screenDelta) {
  return Offset(screenDelta.dx / zoom, screenDelta.dy / zoom);
}