phegman / vue-mapbox-gl

A Vue.js component for Mapbox GL JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use Marker Events?

timvan opened this issue · comments

Hi,

I am trying to use the Marker events, in particular dragend marker.on('dragend', doSomething);

I get how to use map events... @map-event which doesn't work for markers. I also tried attaching the callback to the new marker when created, using the marker.on method above. End goal is to have a draggable marker that fires an update to an api on dragend, to update the new LongLat.

Any help is very appreciated,

Thanks

fixed it

var marker = new mapboxgl.Marker({
    draggable: true
})
marker.on('dragend', e => {
    this.doSomething()
})