From 2184bb6a9e98327f7d756b5977ae5315268f37b3 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 24 Oct 2020 22:34:49 -0700 Subject: Rename plugin --- modern/src/map/GeofenceEditMap.js | 24 ++++++++++++++++++++++++ modern/src/map/GeofenceMap.js | 25 ------------------------- 2 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 modern/src/map/GeofenceEditMap.js delete mode 100644 modern/src/map/GeofenceMap.js 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; diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js deleted file mode 100644 index bca4d204..00000000 --- a/modern/src/map/GeofenceMap.js +++ /dev/null @@ -1,25 +0,0 @@ -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; -- cgit v1.2.3