aratcliffe/Leaflet.contextmenu

Update dynimacaly contextmenu

akaadream opened this issue · 0 comments

Hi !

In my project, i have to display geoJson layers with a defined contextmenu. But when i'm moving the map, i have to update these layers. At this moment, i need to update layer style (no problem for this one), and the contextmenu too but there is no way i can do this or maybe i didn't understood anything ^^'

The contextmenu is defined like that :

let layer = L.geoJson(zone.geometry, {
  bubblingMouseEvents: false,
  style: style,
  zone: zone,
  onEachFeature: (feature, layer) => {
    layer.bindContextMenu(contextmenu);
  }
}

And my goal is to update with a way like that :

layer.updateContextMenu(contextmenu);

I don't know if it's possible to get something like. Maybe it's already existing, but i don't know.
Sorry for that bad english, thanks in advance :)