Leaflet / Leaflet.Editable

Make geometries editable in Leaflet.
http://leaflet.github.io/Leaflet.Editable/doc/api.html
559 stars 197 forks source link

no events for markers #148

Open chocho11 opened 7 years ago

chocho11 commented 7 years ago

hi,

i'm trying to rise event for markers but its seems like it is only possible for vertices on polyline/polygon ! Is it right ?

Thx

opoto commented 7 years ago

Not sure what you want to do, but once you created a marker, eg using: var marker = L.marker(latLng);

You can get click events on this marker by using:

marker.on("click", function(e) { ... })

chocho11 commented 7 years ago

with a marker created by the L.EditControl.extend ?


De : Olivier notifications@github.com Envoyé : mardi 10 octobre 2017 22:12 À : Leaflet/Leaflet.Editable Cc : chocho11; Author Objet : Re: [Leaflet/Leaflet.Editable] no events for markers (#148)

Not sure what you want to do, but once you created a marker, eg using: var marker = L.marker(latLng);

You can get click events on this marker by using:

marker.on("click", function(e) { ... })

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Leaflet/Leaflet.Editable/issues/148#issuecomment-335623724, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AdaUGxHQqY-9DRhQ5zvMkd8irt91cRmGks5sq-vMgaJpZM4Pqwoh.

karlitos commented 6 years ago

You can get notified when a marker is created with the 'commit' event:

map.#on('editable:drawing:commit', (evt) => {
   if (evt.layer instanceof L.Marker) {
      console.log('Halelujah, marker was created');
   }
}