修正地图遮挡关系遮挡
This commit is contained in:
@@ -27,6 +27,7 @@ const mapEl = ref<HTMLElement | null>(null)
|
|||||||
const menuNode = ref<MapNode | null>(null)
|
const menuNode = ref<MapNode | null>(null)
|
||||||
const menuX = ref(0)
|
const menuX = ref(0)
|
||||||
const menuY = ref(0)
|
const menuY = ref(0)
|
||||||
|
const lastRaisedNodeId = ref<string | null>(null)
|
||||||
let map: L.Map | null = null
|
let map: L.Map | null = null
|
||||||
let markerLayer: L.LayerGroup | null = null
|
let markerLayer: L.LayerGroup | null = null
|
||||||
let hasFitBounds = false
|
let hasFitBounds = false
|
||||||
@@ -94,6 +95,7 @@ function nodeDetailHref(nodeId: string): string {
|
|||||||
|
|
||||||
function openNodeMenu(node: MapNode, event: L.LeafletMouseEvent) {
|
function openNodeMenu(node: MapNode, event: L.LeafletMouseEvent) {
|
||||||
L.DomEvent.stopPropagation(event)
|
L.DomEvent.stopPropagation(event)
|
||||||
|
lastRaisedNodeId.value = node.node_id
|
||||||
emit('select-node', node.node_id)
|
emit('select-node', node.node_id)
|
||||||
menuNode.value = node
|
menuNode.value = node
|
||||||
menuX.value = event.originalEvent.clientX
|
menuX.value = event.originalEvent.clientX
|
||||||
@@ -155,6 +157,7 @@ function renderMarkers(forceFit: boolean) {
|
|||||||
}
|
}
|
||||||
const node = item
|
const node = item
|
||||||
const selected = node.node_id === props.selectedNodeId
|
const selected = node.node_id === props.selectedNodeId
|
||||||
|
const raised = selected || node.node_id === lastRaisedNodeId.value
|
||||||
const marker = L.marker([node.latitude, node.longitude], {
|
const marker = L.marker([node.latitude, node.longitude], {
|
||||||
icon: L.divIcon({
|
icon: L.divIcon({
|
||||||
className: `node-marker${selected ? ' selected' : ''}`,
|
className: `node-marker${selected ? ' selected' : ''}`,
|
||||||
@@ -163,10 +166,12 @@ function renderMarkers(forceFit: boolean) {
|
|||||||
iconAnchor: [17, 11],
|
iconAnchor: [17, 11],
|
||||||
}),
|
}),
|
||||||
title: node.label,
|
title: node.label,
|
||||||
|
zIndexOffset: raised ? 1000 : 0,
|
||||||
})
|
})
|
||||||
marker.bindPopup(buildNodePopupHTML(node), { maxWidth: 320, className: 'node-detail-popup' })
|
marker.bindPopup(buildNodePopupHTML(node), { maxWidth: 320, className: 'node-detail-popup' })
|
||||||
marker.on('click', (event) => {
|
marker.on('click', (event) => {
|
||||||
L.DomEvent.stopPropagation(event)
|
L.DomEvent.stopPropagation(event)
|
||||||
|
lastRaisedNodeId.value = node.node_id
|
||||||
closeNodeMenu()
|
closeNodeMenu()
|
||||||
emit('select-node', node.node_id)
|
emit('select-node', node.node_id)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user