aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-24 22:24:23 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-10-24 22:24:23 -0700
commit8d32ac6e16c2b9ceb2a23edf0d6254d1e318c31b (patch)
tree751d81e1807a13368b58f9e924fd3d0fd94b2ad3 /modern/src/map
parent5b8419500610e9a62a264819d7ed7857ac35ac69 (diff)
downloadtrackermap-web-8d32ac6e16c2b9ceb2a23edf0d6254d1e318c31b.tar.gz
trackermap-web-8d32ac6e16c2b9ceb2a23edf0d6254d1e318c31b.tar.bz2
trackermap-web-8d32ac6e16c2b9ceb2a23edf0d6254d1e318c31b.zip
Add geofence editing
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/GeofenceMap.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js
new file mode 100644
index 00000000..bca4d204
--- /dev/null
+++ b/modern/src/map/GeofenceMap.js
@@ -0,0 +1,25 @@
+import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css'
+import MapboxDraw from '@mapbox/mapbox-gl-draw';
+import { useEffect } from 'react';
+
+import { map } from './Map';
+
+const draw = new MapboxDraw({
+ displayControlsDefault: false,
+ controls: {
+ polygon: true,
+ trash: true,
+ },
+});
+
+const GeofenceMap = () => {
+ useEffect(() => {
+ const mm = map;
+ map.addControl(draw, 'top-left');
+ return () => map.removeControl(draw);
+ }, []);
+
+ return null;
+}
+
+export default GeofenceMap;