blob: bca4d20412ffdae8ea71d5eafefd37888d00fb53 (
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
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;
|