diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-10-24 22:34:49 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-10-24 22:34:49 -0700 |
commit | 2184bb6a9e98327f7d756b5977ae5315268f37b3 (patch) | |
tree | 69e18482b6a036711e5ca5cf01d9d8428c9727d0 /modern/src/map/GeofenceEditMap.js | |
parent | 8d32ac6e16c2b9ceb2a23edf0d6254d1e318c31b (diff) | |
download | trackermap-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.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; |