From 88040dc80e5e50f916f91748036eb46ae293a4d6 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Thu, 23 May 2019 08:41:04 +0100 Subject: [PATCH] Fix default icon to exist correctly --- CHANGELOG.md | 1 + README.md | 1 + package.json | 2 +- worldmap/worldmap.js | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92c6ad4..ba93966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.0.10 - Ensure default icon is in place if not specified (regression) - v2.0.9 - Only update maxage on screen once it exists - v2.0.8 - Drop beta flag, re-organise index, js and css files. Now using leaflet 1.4 - v2.0.7-beta - Switch Ruler control to be independent of Draw library. diff --git a/README.md b/README.md index 84e60ea..e6ecd70 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ map web page for plotting "things" on. ### Updates +- v2.0.10 - Ensure default icon is in place if not specified (regression) - v2.0.9 - Only update maxage on screen once it exists - v2.0.8 - Drop beta flag, re-organise index, js and css files. Now using leaflet 1.4 - v2.0.7-beta - Switch Ruler control to be independent of Draw library. diff --git a/package.json b/package.json index 1683856..5a83393 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.0.9", + "version": "2.0.10", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "cgi": "0.3.1", diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 5886847..f0a1683 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1263,18 +1263,8 @@ function setMarker(data) { marker = L.marker(ll, {title:data.name, icon:myMarker, draggable:drag}); labelOffset = [16,-16]; } - else { - myMarker = L.VectorMarkers.icon({ - icon: data.icon || "circle", - markerColor: (data.iconColor || "#910000"), - prefix: 'fa', - iconColor: 'white' - }); - marker = L.marker(ll, {title:data.name, icon:myMarker, draggable:drag}); - labelOffset = [6,-6]; - } } - if (data.hasOwnProperty("SIDC")) { + else if (data.hasOwnProperty("SIDC")) { // "SIDC":"SFGPU------E***","name":"1.C2 komp","fullname":"1.C2 komp/FTS/INSS" myMarker = new ms.Symbol( data.SIDC.toUpperCase(), { uniqueDesignation:data.name }); // Now that we have a symbol we can ask for the echelon and set the symbol size @@ -1289,6 +1279,16 @@ function setMarker(data) { }); marker = L.marker(ll, { title:data.name, icon:myicon, draggable:drag }); } + else { + myMarker = L.VectorMarkers.icon({ + icon: data.icon || "circle", + markerColor: (data.iconColor || "#910000"), + prefix: 'fa', + iconColor: 'white' + }); + marker = L.marker(ll, {title:data.name, icon:myMarker, draggable:drag}); + labelOffset = [6,-6]; + } marker.name = data.name; // var createLabelIcon = function(labelText) {