diff --git a/worldmap/index.html b/worldmap/index.html index ff7e08f..b8ab834 100644 --- a/worldmap/index.html +++ b/worldmap/index.html @@ -69,7 +69,7 @@ - +
Node-RED - map all the things @@ -82,9 +82,9 @@   Set Max Age s Cluster at zoom < - Auto Pan Map - Lock Map - Heatmap all layers + Auto Pan Map + Lock Map + Heatmap all layers Help
@@ -310,26 +310,25 @@ document.getElementById('exitHelp').onclick = function() { }; var panit = false; -function doPanit() { - panit = !panit; +function doPanit(v) { + if (v !== undefined) { panit = v; } console.log("Panit set :",panit); } var heatAll = false; -function doHeatAll() { - heatAll = !heatAll; +function doHeatAll(v) { + if (v !== undefined) { heatall = v; } console.log("Heatall set :",heatAll); } var lockit = false; var mb = new L.LatLngBounds([[-120,-360],[120,360]]); -function doLock() { - if (lockit === true) { - lockit = false; +function doLock(v) { + if (v !== undefined) { lockit = v; + if (lockit === false) { mb = new L.LatLngBounds([[-120,-360],[120,360]]); } else { - lockit = true; mb = map.getBounds(); window.localStorage.setItem("lastpos",JSON.stringify(map.getCenter())); window.localStorage.setItem("lastzoom", map.getZoom()); @@ -1386,13 +1385,15 @@ function setMarker(data) { marker._popup.dname = data.name; marker.lay = lay; // and the layer it is on - var rightmenuMarker = L.popup({offset:[0,-12]}).setContent(""+data.name+"
"+rightcontext); - marker.on('contextmenu', function(e) { - if (hiderightclick !== true) { - rightmenuMarker.setLatLng(e.latlng); - map.openPopup(rightmenuMarker); - } - }); + if (rightcontext.length > 0) { + var rightmenuMarker = L.popup({offset:[0,-12]}).setContent(""+data.name+"
"+rightcontext); + marker.on('contextmenu', function(e) { + if (hiderightclick !== true) { + rightmenuMarker.setLatLng(e.latlng); + map.openPopup(rightmenuMarker); + } + }); + } marker.on('click', function(e) { ws.send(JSON.stringify({action:"click",name:marker.name,layer:marker.lay,icon:marker.icon,iconColor:marker.iconColor,SIDC:marker.SIDC,draggable:true,lat:parseFloat(marker.getLatLng().lat.toFixed(6)),lon:parseFloat(marker.getLatLng().lng.toFixed(6))})); }); @@ -1794,9 +1795,9 @@ function doCommand(cmd) { } if (cmd.hasOwnProperty("panlock")) { - if (cmd.panlock == "true" || cmd.panlock == true) { lockit = false; } - else { lockit = true; doLock(); } - document.getElementById("lockit").checked = !lockit; + if (cmd.panlock == "true" || cmd.panlock == true) { lockit = true; } + else { lockit = false; doLock(false); } + document.getElementById("lockit").checked = lockit; } // move to a new position var clat = map.getCenter().lat; @@ -1821,7 +1822,7 @@ function doCommand(cmd) { document.getElementById("heatall").checked = !!cmd.heatmap; heat.redraw(); } - if (cmd.hasOwnProperty("panlock") && lockit === false) { doLock(); } + if (cmd.hasOwnProperty("panlock") && lockit === true) { doLock(true); } if (cmd.hasOwnProperty("zoomlock")) { if (cmd.zoomlock == "true" || cmd.zoomlock == true) { if (map.doubleClickZoom.enabled()) { map.removeControl(map.zoomControl); }