aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-06-29 21:57:11 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-06-29 21:57:11 -0700
commit249f0437362ffbd3e14aa04a482ce03eb7e351e4 (patch)
treeebc84a90864f25d7f37df8b0de15e7d4bbf6bb74 /modern/src/map
parente7c4812a119c4079110de5da7ccab37970b4fc08 (diff)
downloadetbsa-traccar-web-249f0437362ffbd3e14aa04a482ce03eb7e351e4.tar.gz
etbsa-traccar-web-249f0437362ffbd3e14aa04a482ce03eb7e351e4.tar.bz2
etbsa-traccar-web-249f0437362ffbd3e14aa04a482ce03eb7e351e4.zip
Display edit geofence titles
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/GeofenceEditMap.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/modern/src/map/GeofenceEditMap.js b/modern/src/map/GeofenceEditMap.js
index fa5a1f6..fe84338 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) };