From d750237f97002380559d147abaed1750ac1cebc2 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Thu, 23 May 2019 09:01:00 +0100 Subject: [PATCH] better fix for default icon --- CHANGELOG.md | 2 +- README.md | 2 +- package.json | 2 +- worldmap/worldmap.js | 13 ++++++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba93966..76e006c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ### Change Log for Node-RED Worldmap - - v2.0.10 - Ensure default icon is in place if not specified (regression) + - v2.0.11 - 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 e6ecd70..b2ab26d 100644 --- a/README.md +++ b/README.md @@ -9,7 +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.11 - 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 5a83393..535a591 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.0.10", + "version": "2.0.11", "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 f0a1683..0438733 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1054,6 +1054,7 @@ function setMarker(data) { if (data.draggable === true) { drag = true; } //console.log("ICON",data.icon); + console.log("DATA",data); if (data.hasOwnProperty("icon")) { if (data.icon === "ship") { marker = L.boatMarker(ll, { @@ -1263,6 +1264,16 @@ 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]; + } } else if (data.hasOwnProperty("SIDC")) { // "SIDC":"SFGPU------E***","name":"1.C2 komp","fullname":"1.C2 komp/FTS/INSS" @@ -1281,7 +1292,7 @@ function setMarker(data) { } else { myMarker = L.VectorMarkers.icon({ - icon: data.icon || "circle", + icon: "circle", markerColor: (data.iconColor || "#910000"), prefix: 'fa', iconColor: 'white'