simplified circle labels

main
Inga 🏳‍🌈 6 months ago
parent 4315d0301d
commit c675cf36ee
  1. 38
      src/routePlanner/hooks/useMarkersOnMap/getLayersForMarkers.ts

@ -24,26 +24,20 @@ export const getLayersForMarkers = (
];
}),
// circles and labels
...markers.flatMap((marker) => {
const circle = leaflet.circleMarker(marker.coordinates, {
...markerLayersStyle,
bubblingMouseEvents: false,
fill: true,
fillOpacity: 100,
});
const tooltip = leaflet
.tooltip(
{
permanent: true,
direction: 'center',
className: 'text',
content: marker.shortLabel,
},
circle,
)
.setLatLng(marker.coordinates);
circle.on('click', marker.remove);
return [circle, tooltip];
}),
...markers.map((marker) =>
leaflet
.circleMarker(marker.coordinates, {
...markerLayersStyle.circleStyle,
bubblingMouseEvents: false,
fill: true,
fillOpacity: 100,
})
.on('click', marker.remove)
.bindTooltip(marker.shortLabel, {
permanent: true,
direction: 'center',
className: 'text',
content: marker.shortLabel,
}),
),
];

Loading…
Cancel
Save