diff --git a/CHANGELOG.md b/CHANGELOG.md index 00867dc..635db6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.38.2 - Better fix for geojson multipoint icons. - v2.38.1 - Fix for geojson multipoint icons. - v2.38.0 - Return client headers as part of connect message. - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh diff --git a/README.md b/README.md index e77d453..a55c633 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D% ### Updates +- v2.38.2 - Better fix for geojson multipoint icons. - v2.38.1 - Fix for geojson multipoint icons. - v2.38.0 - Return client headers as part of connect message. - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh diff --git a/package.json b/package.json index 0066b6a..27169b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.38.1", + "version": "2.38.2", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "@turf/bezier-spline": "~6.5.0", diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 00af835..95ec2c1 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -2853,6 +2853,21 @@ function doGeojson(n,g,l,o) { className: "natoicon", }); } + else if (feature.properties["marker-symbol"].substr(0,3) === "fa-") { + try { + var col = feature.properties["marker-color"] ?? "#910000"; + var imod = ""; + if (feature.properties["marker-symbol"].indexOf(" ") === -1) { imod = "fa-2x "; } + myMarker = L.divIcon({ + className:"faicon", + html: '
', + iconSize: [32, 32], + iconAnchor: [16, 12], + popupAnchor: [0, -16] + }); + } + catch(e) { console.log(e); } + } else { myMarker = L.VectorMarkers.icon({ icon: feature.properties["marker-symbol"] ?? "circle", @@ -2867,20 +2882,19 @@ function doGeojson(n,g,l,o) { if (feature.properties.hasOwnProperty("url")) { feature.properties.url = ""+feature.properties.url+""; } - if (feature.geometry.hasOwnProperty("type") && feature.geometry.type !== "MultiPoint") { - delete feature.properties["marker-symbol"]; - delete feature.properties["marker-color"]; - delete feature.properties["marker-size"]; - } var nf = {title:feature.properties.title, name:feature.properties.name}; feature.properties = Object.assign(nf, feature.properties); return L.marker(latlng, {title:feature.properties.title ?? "", icon:myMarker}); } opt.onEachFeature = function (f,l) { if (f.properties && Object.keys(f.properties).length > 0) { - var tx = JSON.stringify(f.properties,null,' '); + var tx = JSON.parse(JSON.stringify(f.properties,null,' ')); + delete tx["marker-symbol"]; + delete tx["marker-color"]; + delete tx["marker-size"]; + tx = JSON.stringify(tx,null,' '); if ( tx !== "{}") { - l.bindPopup('
'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'
'); + l.bindPopup('
'+tx.replace(/[\{\}"]/g,'')+'
'); } } if (o && o.hasOwnProperty("clickable") && o.clickable === true) {