aratcliffe / Leaflet.contextmenu

A context menu for Leaflet.
MIT License
367 stars 107 forks source link

Problem with context menu bindind with mixin #113

Closed m00nlighter closed 6 years ago

m00nlighter commented 6 years ago

with this simple code from readme when u click context menu twice it show 2 copy of menu item added here is gif 1

var jsonLayer = L.geoJson(jsonData, {
    onEachFeature: function (feature, layer) {
        layer.bindContextMenu({
            contextmenu: true,
            contextmenuItems: [{
                text: 'Marker item'
            }]
        });
    }
 }).addTo(map);
m00nlighter commented 6 years ago

adding context menu, true to map config resolve this problem.

var map = L.map('map', {
    layers: [OpenStreetMap_Mapnik],
    contextmenu: true
});
veloper commented 3 years ago

Thank you! @m00nlighter

This solved the issue for me as well.