aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/GeofenceMap.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map/GeofenceMap.js')
-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 0000000..bca4d20
--- /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;