Skip to content

Commit

Permalink
Update maplibre-gl with Deck.gl, Fix right click on feature
Browse files Browse the repository at this point in the history
  • Loading branch information
xbgmsharp committed Sep 23, 2024
1 parent 47eb701 commit 0652f58
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/pages/logs-book/widgets/Map-gl4.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
iconSizeScale: 4,
iconSizeMinPixels: 12,
/* Bug only work on right click
// Handle the click event on the layer using onClick
onClick: (info, event) => {
console.log(info, event)
Expand All @@ -116,14 +117,15 @@
.addTo(map.value)
}
},
*/
}),
],
getTooltip: ({ object }) => object && getTooltip(object),
})
map.value.addControl(deckOverlay)
/*
// Solve bug left click
// Add click event to display popup on left click
map.value.on('click', (event) => {
const [longitude, latitude] = event.lngLat.toArray()
Expand All @@ -136,6 +138,7 @@
if (picked && picked.object) {
const feature = picked.object
const description = getOnClickDesc(feature)
// Remove any existing popup
if (popup) {
Expand All @@ -145,18 +148,10 @@
// Create a new popup
popup = new maplibregl.Popup({ closeOnClick: true })
.setLngLat([longitude, latitude])
.setHTML(
`
<div>
<strong>${feature.properties.name}</strong><br/>
${feature.properties.distance ? `Distance: ${feature.properties.distance}` : ''}<br/>
${feature.properties.duration ? `Duration: ${feature.properties.duration}` : ''}
</div>
`,
)
.setHTML(description)
.addTo(map.value)
}
})*/
})
})
function random_rgb_dark() {
Expand Down

0 comments on commit 0652f58

Please sign in to comment.