Zoom Methods
Note
You can find the full source code of this example in ManualZoomActivity.kt
of the MapLibreAndroidTestApp.
This example shows different methods of zooming in.
Each method uses MapLibreMap.animateCamera
, but with a different CameraUpdateFactory
.
Zooming In
maplibreMap.animateCamera(CameraUpdateFactory.zoomIn())
Zooming Out
maplibreMap.animateCamera(CameraUpdateFactory.zoomOut())
Zoom By Some Amount of Zoom Levels
maplibreMap.animateCamera(CameraUpdateFactory.zoomBy(2.0))
Zoom to a Zoom Level
maplibreMap.animateCamera(CameraUpdateFactory.zoomTo(2.0))
Zoom to a Point
val view = window.decorView
maplibreMap.animateCamera(
CameraUpdateFactory.zoomBy(
1.0,
Point(view.measuredWidth / 4, view.measuredHeight / 4)
)
)