diff --git a/worldmap/index.html b/worldmap/index.html index 78d8dff..ba83556 100644 --- a/worldmap/index.html +++ b/worldmap/index.html @@ -599,7 +599,8 @@ map.on('zoomend', function() { //}); // single right click to add a marker -var rightmenuMap = L.popup({keepInView:true, minWidth:250}).setContent("Add marker
"); +var addmenu = "Add marker
"; +var rightmenuMap = L.popup({keepInView:true, minWidth:250}).setContent(addmenu); var rclk; var hiderightclick = false; @@ -647,7 +648,7 @@ map.on('contextmenu', function(e) { rclicked = true; rtout = setTimeout( function() { rclicked = false; - if (hiderightclick !== true) { + if ((hiderightclick !== true) && (addmenu.length > 0)) { rclk = e.latlng; rightmenuMap.setLatLng(e.latlng); map.openPopup(rightmenuMap); @@ -1514,6 +1515,12 @@ function doCommand(cmd) { } } } + if (cmd.hasOwnProperty("contextmenu")) { + if (typeof cmd.contextmenu === "string") { + addmenu = cmd.contextmenu; + rightmenuMap.setContent(addmenu); + } + } if (cmd.hasOwnProperty("coords")) { try { coords.removeFrom(map); } catch(e) {}