Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 3.1 KB

Camera.md

File metadata and controls

34 lines (31 loc) · 3.1 KB

<MapboxGL.Camera />

Controls the perspective from which the user sees the map.

To use imperative methods, pass in a ref object:

<br/>const camera = useRef<Camera>(null);<br/><br/>useEffect(() => {<br/> camera.current?.setCamera({<br/> centerCoordinate: [lon, lat],<br/> });<br/>}, []);<br/><br/>return (<br/> <Camera ref={camera} /><br/>);<br/>

props

Prop Type Default Required Description
type literal none false Allows static check of the data type. For internal use only.
centerCoordinate Position none false The location on which the map should center.
bounds intersection none false The corners of a box around which the map should bound. Contains padding props for backwards
compatibility; the root padding prop should be used instead.
heading number none false The heading (orientation) of the map.
pitch number none false The pitch of the map.
zoomLevel number none false The zoom level of the map.
padding {paddingLeft:number;paddingRight:number;paddingTop:number;paddingBottom:number;} none false The viewport padding in points.
animationDuration number none false The duration the map takes to animate to a new configuration.
animationMode `| 'flyTo'
| 'easeTo'
| 'linearTo'
| 'moveTo'
| 'none'` none false The easing or path the camera uses to animate to a new configuration.
followUserMode UserTrackingMode none false The mode used to track the user location on the map.
followUserLocation boolean none false Whether the map orientation follows the user location.
followZoomLevel number none false The zoom level used when following the user location.
followPitch number none false The pitch used when following the user location.
followHeading number none false The heading used when following the user location.
minZoomLevel number none false The lowest allowed zoom level.
maxZoomLevel number none false The highest allowed zoom level.
maxBounds {ne:Position;sw:Position;} none false The corners of a box defining the limits of where the camera can pan or zoom.
defaultSettings FIX ME FORMAT BIG OBJECT none false The configuration that the camera falls back on, if no other values are specified.
allowUpdates boolean none false Whether the camera should send any configuration to the native module. Prevents unnecessary tile
fetching and improves performance when the map is not visible. Defaults to true.
triggerKey string | number none false Any arbitrary primitive value that, when changed, causes the camera to retry moving to its target
configuration. (Not yet implemented.)
onUserTrackingModeChange UserTrackingModeChangeCallback none false Executes when user tracking mode changes.