aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/MainPage.js2
-rw-r--r--modern/src/map/GeofenceMap.js25
2 files changed, 26 insertions, 1 deletions
diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js
index ada6c01b..de486b2f 100644
--- a/modern/src/MainPage.js
+++ b/modern/src/MainPage.js
@@ -56,8 +56,8 @@ const MainPage = ({ width }) => {
<div className={classes.mapContainer}>
<ContainerDimensions>
<Map>
- <SelectedDeviceMap />
<PositionsMap />
+ <SelectedDeviceMap />
</Map>
</ContainerDimensions>
</div>
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;