diff options
Diffstat (limited to 'modern/src/map/GeofenceEditMap.js')
-rw-r--r-- | modern/src/map/GeofenceEditMap.js | 24 |
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; |