add: fields layer labeles popup

v0.8
rrr-marble 3 years ago
parent 60fa0cc4e0
commit 24024790b5

@ -1,7 +1,7 @@
<template> <template>
<div class="map-wrap"> <div class="map-wrap">
<div id="layer-control" class="d-flex flex-direction-column"> <div id="layer-control" class="d-flex flex-direction-column">
<va-checkbox class="mb-4" v-model="valuecb" :label="labelcb" /> <va-checkbox class="mb-4" v-model="valuecb" label="Месторождения" />
</div> </div>
<div id="map" class="map" ref="mapContainer"></div> <div id="map" class="map" ref="mapContainer"></div>
</div> </div>
@ -24,7 +24,6 @@ export default {
const map = shallowRef(null); const map = shallowRef(null);
let currentFadr = reactive({ "fadr": [] }); let currentFadr = reactive({ "fadr": [] });
const valuecb = ref(true); const valuecb = ref(true);
const labelcb = 'Месторождения'
const apiKey = "pk.eyJ1IjoiZ2hlcm1hbnQiLCJhIjoiY2pncDUwcnRmNDQ4ZjJ4czdjZXMzaHZpNyJ9.3rFyYRRtvLUngHm027HZ7A"; const apiKey = "pk.eyJ1IjoiZ2hlcm1hbnQiLCJhIjoiY2pncDUwcnRmNDQ4ZjJ4czdjZXMzaHZpNyJ9.3rFyYRRtvLUngHm027HZ7A";
@ -116,7 +115,23 @@ export default {
const popup = new maplibregl.Popup({ const popup = new maplibregl.Popup({
closeButton: false, closeButton: false,
closeOnClick: false, closeOnClick: false,
}) });
map.value.on("dblclick", "fields-layer", (e) => {
new maplibregl.Popup({})
.setLngLat(e.lngLat)
.setHTML(e.features[0].properties["descriptio"])
.addTo(map.value);
});
map.value.on("mouseover", "fields-layer", (e) => {
map.value.getCanvas().style.cursor = "pointer";
});
map.value.on("mouseleave", "fields-layer", (e) => {
map.value.getCanvas().style.cursor = "";
});
map.value.on('mouseover', 'samples-layer', (e) => { map.value.on('mouseover', 'samples-layer', (e) => {
// Change the cursor style as a UI indicator. // Change the cursor style as a UI indicator.
@ -221,7 +236,6 @@ export default {
const updateFieldsLayer = () => { const updateFieldsLayer = () => {
const visibility = valuecb.value ? 'visible' : 'none'; const visibility = valuecb.value ? 'visible' : 'none';
map.value.setLayoutProperty('fields-layer', 'visibility', visibility); map.value.setLayoutProperty('fields-layer', 'visibility', visibility);
}; };
@ -236,7 +250,7 @@ export default {
return { return {
map, mapContainer, currentFadr, valuecb, labelcb map, mapContainer, currentFadr, valuecb
} }
} }
} }

Loading…
Cancel
Save