vue-mapbox
vue-mapbox copied to clipboard
Listening on layer events
Hi,
I would like to support the listening of events on a specific layer, the ones you can catch with "on(type, layerId, listener)"
. It works when we add a specific layer, but not on the map.
I'm thinking of adding special events handlers, such as: click-layerid
, mousedown-layerid
, and so on...
<template>
<MglMap
:map-style="..."
@mouseover-poi="handleMouseOver"
@click-poi="handleClick"
></MglMap>
</template>
<script>
export default {
methods: {
handleClick() {},
handleMouseOver(e) { e.map.getCanvas().style.cursor = 'pointer';}
}
}
</script>
What do you think ?
You already have those in this library.
Common layer evts: https://soal.github.io/vue-mapbox/api/Layers/#events
Yes I would have to add a layer, but they are already on the original source and style.