aratcliffe / Leaflet.contextmenu

A context menu for Leaflet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with context menu bindind with mixin

m00nlighter opened this issue · comments

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);

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

var map = L.map('map', {
    layers: [OpenStreetMap_Mapnik],
    contextmenu: true
});

Thank you! @m00nlighter

This solved the issue for me as well.