latLngToScreenOffset method

Offset latLngToScreenOffset(
  1. LatLng latLng
)

This will convert a latLng to a position that we could use with a widget outside of FlutterMap layer space. Eg using a Positioned Widget.

Implementation

Offset latLngToScreenOffset(LatLng latLng) {
  final nonRotatedPixelOrigin =
      projectAtZoom(center, zoom) - nonRotatedSize.center(Offset.zero);

  var point = crs.latLngToOffset(latLng, zoom);

  final mapCenter = crs.latLngToOffset(center, zoom);

  if (rotation != 0.0) {
    point = rotatePoint(mapCenter, point, counterRotation: false);
  }

  return point - nonRotatedPixelOrigin;
}