optional ruler (#206)
This commit is contained in:
parent
027e459182
commit
6f28ffc91e
@ -93,6 +93,13 @@
|
||||
<option value="true">Visible</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-showruler"><i class="fa fa-window-minimize"></i> Ruler</label>
|
||||
<select id="node-input-showruler" style="width:101px;">
|
||||
<option value="false">Not shown</option>
|
||||
<option value="true">Visible</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-path"><i class="fa fa-globe"></i> Web Path</label>
|
||||
<input type="text" id="node-input-path" placeholder="worldmap" style="width:30%;">
|
||||
@ -252,6 +259,13 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
||||
<option value="true">Visible</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-showruler"><i class="fa fa-window-minimize"></i> Ruler</label>
|
||||
<select id="node-input-showruler" style="width:101px;">
|
||||
<option value="false">Not shown</option>
|
||||
<option value="true">Visible</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-path"><i class="fa fa-globe"></i> Web Path</label>
|
||||
<input type="text" id="node-input-path" placeholder="worldmap" style="width:30%;">
|
||||
@ -364,6 +378,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
||||
hiderightclick: {value:"false"},
|
||||
coords: {value:"false"},
|
||||
showgrid: {value:"false"},
|
||||
showruler: {value:"false"},
|
||||
allowFileDrop: {value:"false"},
|
||||
path: {value:"/worldmap"},
|
||||
overlist: {value:"DR,CO,RA,DN,HM"},
|
||||
@ -477,6 +492,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
||||
hiderightclick: {value:"true"},
|
||||
coords: {value:"false"},
|
||||
showgrid: {value:"false"},
|
||||
showruler: {value:"false"},
|
||||
allowFileDrop: {value:"false"},
|
||||
path: {value:"/worldmap"},
|
||||
overlist: {value:"DR,CO,RA,DN,HM"},
|
||||
|
@ -31,6 +31,7 @@ module.exports = function(RED) {
|
||||
node.hiderightclick = n.hiderightclick || "false";
|
||||
node.coords = n.coords || "none";
|
||||
node.showgrid = n.showgrid || "false";
|
||||
node.showruler = n.showruler || "false";
|
||||
node.allowFileDrop = n.allowFileDrop || "false";
|
||||
node.path = n.path || "/worldmap";
|
||||
node.maplist = n.maplist;
|
||||
@ -101,6 +102,7 @@ module.exports = function(RED) {
|
||||
c.zoomlock = node.zoomlock;
|
||||
c.showlayers = node.layers;
|
||||
c.grid = {showgrid:node.showgrid};
|
||||
c.ruler = {showruler:node.showruler};
|
||||
c.hiderightclick = node.hiderightclick;
|
||||
c.allowFileDrop = node.allowFileDrop;
|
||||
c.coords = node.coords;
|
||||
|
@ -337,10 +337,7 @@ else {
|
||||
// map.locate({setView:true, maxZoom:16});
|
||||
// }, "Locate me").addTo(map);
|
||||
|
||||
// Add the measure/ruler button
|
||||
rulerButton.addTo(map);
|
||||
|
||||
// Create the clear heatmap button
|
||||
// Create the clear heatmap button
|
||||
var clrHeat = L.easyButton( 'fa-eraser', function() {
|
||||
console.log("Reset heatmap");
|
||||
heat.setLatLngs([]);
|
||||
@ -360,6 +357,7 @@ document.getElementById('menu').innerHTML = helpMenu;
|
||||
|
||||
// Add graticule
|
||||
var showGrid = false;
|
||||
var showRuler = false;
|
||||
var Lgrid = L.latlngGraticule({
|
||||
font: "Verdana",
|
||||
fontColor: "#666",
|
||||
@ -2170,8 +2168,8 @@ function doCommand(cmd) {
|
||||
if ((cmd.grid.showgrid == "false" || cmd.grid.showgrid == false ) && showGrid) { changed = true; }
|
||||
if (changed) {
|
||||
showGrid = !showGrid;
|
||||
if (showGrid) { Lgrid.addTo(map); rulerButton.addTo(map); }
|
||||
else { Lgrid.removeFrom(map); rulerButton.remove(); }
|
||||
if (showGrid) { Lgrid.addTo(map);}
|
||||
else { Lgrid.removeFrom(map);}
|
||||
}
|
||||
}
|
||||
if (cmd.grid.hasOwnProperty("opt")) {
|
||||
@ -2182,6 +2180,18 @@ function doCommand(cmd) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cmd.hasOwnProperty("ruler")) {
|
||||
if (cmd.ruler.hasOwnProperty("showruler")) {
|
||||
var changed = false;
|
||||
if ((cmd.ruler.showruler == "true" || cmd.ruler.showruler == true ) && !showRuler) { changed = true; }
|
||||
if ((cmd.ruler.showruler == "false" || cmd.ruler.showruler == false ) && showRuler) { changed = true; }
|
||||
if (changed) {
|
||||
showRuler = !showRuler;
|
||||
if (showRuler) { rulerButton.addTo(map); }
|
||||
else { rulerButton.remove(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cmd.hasOwnProperty("button")) {
|
||||
if (!Array.isArray(cmd.button)) { cmd.button = [cmd.button]; }
|
||||
cmd.button.forEach(function(b) {
|
||||
|
Loading…
Reference in New Issue
Block a user