From 5c5e8456f6e4bad1c4fad5f39bc65a3dff8c0abf Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 18 Mar 2019 09:01:47 +0000 Subject: [PATCH] add command.conextmenu for main right click updates --- worldmap/index.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) {}