distanceToCenter method

double distanceToCenter(
  1. double x,
  2. double y
)

Distance in pixels between the pixel position (x, y) and the content center.

Implementation

double distanceToCenter(double x, double y) {
  final c = centerOffsets;

  final xDist = x > c.x ? x - c.x : c.x - x;
  final yDist = y > c.y ? y - c.y : c.y - y;

  final dist = math.sqrt(math.pow(xDist, 2) + math.pow(yDist, 2));

  MPPointF.recycleInstance(c);

  return dist;
}