diff options
Diffstat (limited to 'modern/src/map')
-rw-r--r-- | modern/src/map/GeofenceEditMap.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/modern/src/map/GeofenceEditMap.js b/modern/src/map/GeofenceEditMap.js index fa5a1f63..fe843382 100644 --- a/modern/src/map/GeofenceEditMap.js +++ b/modern/src/map/GeofenceEditMap.js @@ -1,5 +1,6 @@ import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css' import MapboxDraw from '@mapbox/mapbox-gl-draw'; +import theme from '@mapbox/mapbox-gl-draw/src/lib/theme'; import { useEffect } from 'react'; import { map } from './Map'; @@ -14,6 +15,21 @@ const draw = new MapboxDraw({ polygon: true, trash: true, }, + userProperties: true, + styles: [...theme, { + 'id': 'gl-draw-title', + 'type': 'symbol', + 'filter': ['all'], + 'layout': { + 'text-field': '{user_name}', + 'text-font': ['Roboto Regular'], + 'text-size': 12, + }, + 'paint': { + 'text-halo-color': 'white', + 'text-halo-width': 1, + }, + }], }); const GeofenceEditMap = () => { @@ -34,8 +50,6 @@ const GeofenceEditMap = () => { map.addControl(draw, 'top-left'); - - map.on('draw.create', async event => { const feature = event.features[0]; const newItem = { name: '', area: geometryToArea(feature.geometry) }; |