aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/GeofenceEditMap.js
blob: 9487e97ca46fd606fc45aff4995cdf29851f3eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;