aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/GeofenceEditMap.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-24 22:34:49 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-10-24 22:34:49 -0700
commit2184bb6a9e98327f7d756b5977ae5315268f37b3 (patch)
tree69e18482b6a036711e5ca5cf01d9d8428c9727d0 /modern/src/map/GeofenceEditMap.js
parent8d32ac6e16c2b9ceb2a23edf0d6254d1e318c31b (diff)
downloadtrackermap-web-2184bb6a9e98327f7d756b5977ae5315268f37b3.tar.gz
trackermap-web-2184bb6a9e98327f7d756b5977ae5315268f37b3.tar.bz2
trackermap-web-2184bb6a9e98327f7d756b5977ae5315268f37b3.zip
Rename plugin
Diffstat (limited to 'modern/src/map/GeofenceEditMap.js')
-rw-r--r--modern/src/map/GeofenceEditMap.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/modern/src/map/GeofenceEditMap.js b/modern/src/map/GeofenceEditMap.js
new file mode 100644
index 00000000..9487e97c
--- /dev/null
+++ b/modern/src/map/GeofenceEditMap.js
@@ -0,0 +1,24 @@
+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 GeofenceEditMap = () => {
+ useEffect(() => {
+ map.addControl(draw, 'top-left');
+ return () => map.removeControl(draw);
+ }, []);
+
+ return null;
+}
+
+export default GeofenceEditMap;