better fix for default icon

This commit is contained in:
Dave Conway-Jones 2019-05-23 09:01:00 +01:00
parent 88040dc80e
commit d750237f97
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
4 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,6 @@
### Change Log for Node-RED Worldmap ### 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.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.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. - v2.0.7-beta - Switch Ruler control to be independent of Draw library.

View File

@ -9,7 +9,7 @@ map web page for plotting "things" on.
### Updates ### 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.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.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. - v2.0.7-beta - Switch Ruler control to be independent of Draw library.

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "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.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

@ -1054,6 +1054,7 @@ function setMarker(data) {
if (data.draggable === true) { drag = true; } if (data.draggable === true) { drag = true; }
//console.log("ICON",data.icon); //console.log("ICON",data.icon);
console.log("DATA",data);
if (data.hasOwnProperty("icon")) { if (data.hasOwnProperty("icon")) {
if (data.icon === "ship") { if (data.icon === "ship") {
marker = L.boatMarker(ll, { marker = L.boatMarker(ll, {
@ -1263,6 +1264,16 @@ function setMarker(data) {
marker = L.marker(ll, {title:data.name, icon:myMarker, draggable:drag}); marker = L.marker(ll, {title:data.name, icon:myMarker, draggable:drag});
labelOffset = [16,-16]; 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")) { else if (data.hasOwnProperty("SIDC")) {
// "SIDC":"SFGPU------E***","name":"1.C2 komp","fullname":"1.C2 komp/FTS/INSS" // "SIDC":"SFGPU------E***","name":"1.C2 komp","fullname":"1.C2 komp/FTS/INSS"
@ -1281,7 +1292,7 @@ function setMarker(data) {
} }
else { else {
myMarker = L.VectorMarkers.icon({ myMarker = L.VectorMarkers.icon({
icon: data.icon || "circle", icon: "circle",
markerColor: (data.iconColor || "#910000"), markerColor: (data.iconColor || "#910000"),
prefix: 'fa', prefix: 'fa',
iconColor: 'white' iconColor: 'white'