zoomBy abstract method

void zoomBy(
  1. double factor,
  2. Point2D origin
)

Zooms in or out by a specified factor.

This effectively changes the distance from the camera to the MapCameraState.targetCoordinates by the specified factor, which changes MapCameraState.zoomLevel as well.

Values above 1.0 will zoom in and values below will zoom out.

The relation with MapCameraState.distanceToTargetInMeters is inversely linear, meaning that zooming by 4 will decrease distance to target by 4 while zooming by 0.5 will increase distance to target by 2.

The relation with zoom level is logarithmic. Meaning that zooming by a factor of 4 will increase zoom level by 2 (because log2(4) == 2). So to zoom in by X zoom levels, the zoom factor needs to be 2^X. To zoom out by X zoom levels, zoom factor needs to be 1/(2^X).

The zooming occurs around the specified origin inside the view.

  • factor The zoom factor. Values above 1.0 will zoom in and values below will zoom out.

  • origin Pixel point in view coordinates around which zooming occurs.

Implementation

void zoomBy(double factor, Point2D origin);