diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-28 07:37:24 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-28 07:37:24 -0700 |
commit | 47fdc633966a8f2baefb5424042de6be2ecd1ab6 (patch) | |
tree | 9817e5b02898636f146c4ed7c62aa8221310bb6f /modern/src/map/MapCamera.js | |
parent | ab26340ead6eba063734286a374101951d08688b (diff) | |
download | trackermap-web-47fdc633966a8f2baefb5424042de6be2ecd1ab6.tar.gz trackermap-web-47fdc633966a8f2baefb5424042de6be2ecd1ab6.tar.bz2 trackermap-web-47fdc633966a8f2baefb5424042de6be2ecd1ab6.zip |
Add map to stops report
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; |