pixelBoundsAtZoom method

Rect pixelBoundsAtZoom(
  1. double zoom
)

Calculates the pixel bounds of this MapCamera at the given zoom.

Implementation

Rect pixelBoundsAtZoom(double zoom) {
  Size cameraSize = size;
  if (zoom != this.zoom) {
    final scale = getZoomScale(this.zoom, zoom);
    cameraSize = size / (scale * 2);
  }
  final pixelCenter = projectAtZoom(center, zoom).floor();

  return Rect.fromCenter(
      center: pixelCenter,
      width: cameraSize.width,
      height: cameraSize.height);
}