diff options
Diffstat (limited to 'modern/src/map/MapCamera.js')
-rw-r--r-- | modern/src/map/MapCamera.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modern/src/map/MapCamera.js b/modern/src/map/MapCamera.js new file mode 100644 index 00000000..7ebf24fb --- /dev/null +++ b/modern/src/map/MapCamera.js @@ -0,0 +1,18 @@ +import { useEffect } from 'react'; + +import { map } from './core/MapView'; + +const MapCamera = ({ + latitude, longitude, +}) => { + useEffect(() => { + map.jumpTo({ + center: [longitude, latitude], + zoom: Math.max(map.getZoom(), 10), + }); + }, [latitude, longitude]); + + return null; +}; + +export default MapCamera; |