aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/MapCamera.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-28 07:37:24 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-28 07:37:24 -0700
commit47fdc633966a8f2baefb5424042de6be2ecd1ab6 (patch)
tree9817e5b02898636f146c4ed7c62aa8221310bb6f /modern/src/map/MapCamera.js
parentab26340ead6eba063734286a374101951d08688b (diff)
downloadtrackermap-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.js18
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;