getWorldWidthAtZoom method

double getWorldWidthAtZoom([
  1. double? zoom
])

Returns the width of the world at the current zoom, or 0 if irrelevant.

Implementation

double getWorldWidthAtZoom([double? zoom]) {
  if (!crs.replicatesWorldLongitude) {
    return 0;
  }
  final offset0 = projectAtZoom(const LatLng(0, 0), zoom ?? this.zoom);
  final offset180 = projectAtZoom(const LatLng(0, 180), zoom ?? this.zoom);
  return 2 * (offset180.dx - offset0.dx).abs();
}