pixelToLatLng method

MapLatLng pixelToLatLng(
  1. Offset position
)

Converts pixel point to MapLatLng.

Implementation

MapLatLng pixelToLatLng(Offset position) {
  final Offset localPointCenterDiff = Offset(
    (_state._size!.width / 2) - position.dx,
    (_state._size!.height / 2) - position.dy,
  );
  final Offset actualCenterPixelPosition = _pixelFromLatLng(
    _state._currentFocalLatLng,
    _state._currentZoomLevel,
  );
  final Offset newCenterPoint =
      actualCenterPixelPosition - localPointCenterDiff;
  return _pixelToLatLng(newCenterPoint, _state._currentZoomLevel);
}