useMapZoom
Reads the current zoom state from MapZoom
Use it inside MapZoom when you need zoom values
Returns undefined if used outside MapZoom
Return value
| Property | Type |
|---|---|
center | [number, number] | undefined |
zoom | number |
minZoom | number |
maxZoom | number |
zoomToObject(object, callback) | (object: ZoomObject, callback: (view: ObjectZoomView) => void) => void |
zoomToObject
Computes a fitted zoom view for the given object and passes the full ObjectZoomView to the callback
:::
Best Practice
- Use useMapContext alongside it when controls need map features or the shared path generator
- Use
zoomToObjectto derive a fitted view, then hand the resultingcenterandzoomback to parent-controlled state