toLatLng method

LatLng toLatLng(
  1. Offset position
)

Converts XY coordinates to LatLng.

Implementation

LatLng toLatLng(Offset position) {
  final scale = pow(2.0, controller.zoom);
  final norm = controller.projection.toTileIndex(controller.center);

  final dx = _centerX - position.dx;
  final dy = _centerY - position.dy;

  final x = norm.x - (dx / tileSize) / scale;
  final y = norm.y - (dy / tileSize) / scale;

  final mon = TileIndex(x, y);
  final location = controller.projection.toLatLng(mon);

  return location;
}