msc: popup with number of features on hover

map
g 3 years ago
parent 75e795417b
commit 451e02f6e4

@ -93,6 +93,12 @@ export default {
map.value.on('mouseover', 'samples-layer', (e) => {
// Change the cursor style as a UI indicator.
map.value.getCanvas().style.cursor = 'pointer';
// Populate the popup and set its coordinates
// based on the feature found.
popup
.setLngLat(e.lngLat)
.setHTML(`Записей в точке: <b>${e.features.length}</b>`)
.addTo(map.value);
});
map.value.on('mouseleave', 'samples-layer', (e) => {
@ -101,12 +107,6 @@ export default {
});
map.value.on('click', 'samples-layer', (e) => {
// Populate the popup and set its coordinates
// based on the feature found.
popup
.setLngLat(e.lngLat)
.setHTML(JSON.stringify(e.features[0].properties))
.addTo(map.value);
let newFadr = e.features[0].properties["fadr"];
let newFadrFound = currentFadr["fadr"].indexOf(newFadr)

Loading…
Cancel
Save