focusedZoomCenter method
Calculate the center point which would keep the same point of the map
visible at the given cursorPos with the zoom set to zoom.
Implementation
LatLng focusedZoomCenter(Offset cursorPos, double zoom) {
// Calculate offset of mouse cursor from viewport center
final offset =
(cursorPos - nonRotatedSize.center(Offset.zero)).rotate(rotationRad);
// Match new center coordinate to mouse cursor position
final scale = getZoomScale(zoom, this.zoom);
final newOffset = offset * (1.0 - 1.0 / scale);
final mapCenter = projectAtZoom(center);
final newCenter = unprojectAtZoom(mapCenter + newOffset);
return newCenter;
}