node-red-contrib-web-worldmap 2.23.0 → 2.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -673,7 +673,7 @@ var addThing = function() {
673
673
  var hdg = parseFloat(bits[4] || 0);
674
674
  var drag = true;
675
675
  var regi = /^[S,G,E,I,O][A-Z]{3}.*/i; // if it looks like a SIDC code
676
- var d = {action:"point", name:bits[0].trim(), layer:lay, draggable:drag, lat:rclk.lat, lon:rclk.lng, hdg:hdg};
676
+ var d = {action:"point", name:bits[0].trim(), layer:lay, draggable:drag, lat:rclk.lat, lon:rclk.lng, hdg:hdg, ttl:0 };
677
677
  if (regi.test(icon)) {
678
678
  d.SIDC = (icon.toUpperCase()+"------------").substr(0,12);
679
679
  }
@@ -1351,13 +1351,15 @@ function setMarker(data) {
1351
1351
  opt.color = data.color || data.lineColor || "#910000";
1352
1352
  opt.fillColor = data.fillColor || "#910000";
1353
1353
  opt.stroke = (data.hasOwnProperty("stroke")) ? data.stroke : true;
1354
- opt.weight = data.weight || 2;
1355
- opt.opacity = data.opacity || 1;
1354
+ opt.weight = data.weight;
1355
+ opt.opacity = data.opacity;
1356
1356
  opt.fillOpacity = data.fillOpacity;
1357
1357
  opt.clickable = (data.hasOwnProperty("clickable")) ? data.clickable : false;
1358
1358
  opt.fill = (data.hasOwnProperty("fill")) ? data.fill : true;
1359
1359
  if (data.hasOwnProperty("dashArray")) { opt.dashArray = data.dashArray; }
1360
1360
  if (opt.fillOpacity === undefined) { opt.fillOpacity = 0.2; }
1361
+ if (opt.opacity === undefined) { opt.opacity = 1; }
1362
+ if (opt.weight === undefined) { opt.weight = 2; }
1361
1363
 
1362
1364
  // Replace building
1363
1365
  if (data.hasOwnProperty("building")) {
@@ -1432,6 +1434,9 @@ function setMarker(data) {
1432
1434
  if (data.area.length === 2) { polyarea = L.rectangle(data.area, opt); }
1433
1435
  else { polyarea = L.polygon(data.area, opt); }
1434
1436
  polygons[data.name] = rightmenu(polyarea);
1437
+ if (data.hasOwnProperty("fit") && data.fit === true) {
1438
+ map.fitBounds(polygons[data.name].getBounds(),{padding:[50,50]})
1439
+ }
1435
1440
  }
1436
1441
  else if (data.hasOwnProperty("sdlat") && data.hasOwnProperty("sdlon")) {
1437
1442
  if (!data.hasOwnProperty("iconColor")) { opt.color = "blue"; } //different standard Color Settings
@@ -2062,9 +2067,11 @@ function setMarker(data) {
2062
2067
  function doCommand(cmd) {
2063
2068
  // console.log("COMMAND",cmd);
2064
2069
  if (cmd.init && cmd.hasOwnProperty("maplist")) {
2070
+ basemaps = [];
2065
2071
  addBaseMaps(cmd.maplist,cmd.layer);
2066
2072
  }
2067
2073
  if (cmd.init && cmd.hasOwnProperty("overlist")) {
2074
+ overlays = [];
2068
2075
  addOverlays(cmd.overlist);
2069
2076
  }
2070
2077
  if (cmd.hasOwnProperty("toptitle")) {
package/worldmap.html CHANGED
@@ -383,6 +383,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
383
383
  return 'The map can be found [here]('+RED.settings.httpNodeRoot.slice(0,-1)+this.path+').';
384
384
  },
385
385
  oneditprepare: function() {
386
+ var mshort;
386
387
  if (this.maplist === undefined) {
387
388
  $("#node-input-maplist").val("OSMG,OSMC,EsriC,EsriS,EsriT,EsriO,EsriDG,NatGeo,UKOS,OpTop,SW");
388
389
  this.maplist = "OSMG,OSMC,EsriC,EsriS,EsriT,EsriO,EsriDG,NatGeo,UKOS,OpTop,SW";
@@ -398,7 +399,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
398
399
  }]});
399
400
  $("#node-input-layer").typedInput({type:"laye", types:[{
400
401
  value: "laye",
401
- options: mlist
402
+ options: mshort
402
403
  }]});
403
404
  $("#node-input-overlist").typedInput({type:"overlay", types:[{
404
405
  value: "overlay",
@@ -406,7 +407,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
406
407
  options: olist
407
408
  }]});
408
409
  $("#node-input-maplist").on('change', function(event, type, value) {
409
- var mshort = mlist.filter(e => value.indexOf(e.value)!==-1);
410
+ mshort = mlist.filter(e => value.indexOf(e.value)!==-1);
410
411
  mshort.push({ value:"Custom", label:"Custom Map Provider" });
411
412
  $("#node-input-layer").typedInput("types", [{
412
413
  value: "laye",
@@ -493,6 +494,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
493
494
  return this.name?"node_label_italic":"";
494
495
  },
495
496
  oneditprepare: function() {
497
+ var mshort;
496
498
  if (this.maplist === undefined) {
497
499
  $("#node-input-maplist").val("OSMG,OSMC,EsriC,EsriS,EsriT,EsriO,EsriDG,NatGeo,UKOS,OpTop,SW");
498
500
  this.maplist = "OSMG,OSMC,EsriC,EsriS,EsriT,EsriO,EsriDG,NatGeo,UKOS,OpTop,SW";
@@ -508,7 +510,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
508
510
  }]});
509
511
  $("#node-input-layer").typedInput({type:"laye", types:[{
510
512
  value: "laye",
511
- options: mlist
513
+ options: mshort
512
514
  }]});
513
515
  $("#node-input-overlist").typedInput({type:"overlay", types:[{
514
516
  value: "overlay",
@@ -516,7 +518,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
516
518
  options: olist
517
519
  }]});
518
520
  $("#node-input-maplist").on('change', function(event, type, value) {
519
- var mshort = mlist.filter(e => value.indexOf(e.value)!==-1);
521
+ mshort = mlist.filter(e => value.indexOf(e.value)!==-1);
520
522
  mshort.push({ value:"Custom", label:"Custom Map Provider" });
521
523
  $("#node-input-layer").typedInput("types", [{
522
524
  value: "laye",
package/worldmap.js CHANGED
@@ -486,16 +486,16 @@ module.exports = function(RED) {
486
486
  node.send(newmsg);
487
487
  }
488
488
  if (leafletHull.length === 2 && (oldl === 1 || oldl === 3)) {
489
- newmsg.payload.deleted = true;
490
- node.send(newmsg);
491
- delete newmsg.payload.deleted;
489
+ var newmsg2 = RED.util.cloneMessage(newmsg);
490
+ newmsg2.payload.deleted = true;
491
+ node.send(newmsg2);
492
492
  newmsg.payload.line = leafletHull;
493
493
  node.send(newmsg);
494
494
  }
495
495
  if (leafletHull.length === 3 && oldl === 2) {
496
- newmsg.payload.deleted = true;
497
- node.send(newmsg);
498
- delete newmsg.payload.deleted;
496
+ var newmsg3 = RED.util.cloneMessage(newmsg);
497
+ newmsg3.payload.deleted = true;
498
+ node.send(newmsg3);
499
499
  }
500
500
  if (leafletHull.length >= 3) {
501
501
  newmsg.payload.area = leafletHull;