delete markers from heatmap when removed.

to close #218
bump for release
This commit is contained in:
Dave Conway-Jones 2022-12-13 14:40:36 +00:00
parent 4e18987139
commit 1bdc44f4f9
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 16 additions and 5 deletions

View File

@ -1,6 +1,9 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.33.3 - Undo previous fix as while more technically correct - doesn't look so good. Issue #217 - v2.32.0 - Change || to nullish operator ?? to fix numerous dodgy assignments. Issue #219
Delete marker now also removes from heatmap layer. Issue #218
- v2.31.3 - Undo previous fix as while more technically correct - doesn't look so good. Issue #217
- v2.31.2 = Fix more antimeridian crossing wrinkles. Issue #216 - v2.31.2 = Fix more antimeridian crossing wrinkles. Issue #216
- v2.31.1 - Fix missing type property for drawings, and pass back feedback value. Add route distance. Issue #213, Issue #212, PR #215 - v2.31.1 - Fix missing type property for drawings, and pass back feedback value. Add route distance. Issue #213, Issue #212, PR #215
- v2.31.0 - Better handling of KML files. Issue #211 - v2.31.0 - Better handling of KML files. Issue #211

View File

@ -11,7 +11,9 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.33.3 - Undo previous fix as while more technically correct - doesn't look so good. Issue #217 - v2.32.0 - Change || to nullish operator ?? to fix numerous dodgy assignments. Issue #219
Delete marker now also removes from heatmap layer. Issue #218
- v2.31.3 - Undo previous fix as while more technically correct - doesn't look so good. Issue #217
- v2.31.2 = Fix more antimeridian crossing wrinkles. Issue #216 - v2.31.2 = Fix more antimeridian crossing wrinkles. Issue #216
- v2.31.1 - Fix missing type property for drawings, and pass back feedback value. Add route distance. Issue #213, Issue #212, PR #215 - v2.31.1 - Fix missing type property for drawings, and pass back feedback value. Add route distance. Issue #213, Issue #212, PR #215
- v2.31.0 - Better handling of KML files. Issue #211 - v2.31.0 - Better handling of KML files. Issue #211

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "2.31.3", "version": "2.32.0",
"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": {
"@turf/bezier-spline": "~6.5.0", "@turf/bezier-spline": "~6.5.0",

View File

@ -1214,9 +1214,13 @@ var addOverlays = function(overlist) {
}); });
} }
// Add the heatmap layer // Add the heatmap layer (and add delete LatLng function)
if (overlist.indexOf("HM")!==-1) { if (overlist.indexOf("HM")!==-1) {
heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}}); heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}});
heat.delLatLng = function(ll) {
heat._latlngs = heat._latlngs.filter(v => { return v != ll; } );
heat._redraw();
}
layers["_heat"] = new L.LayerGroup().addLayer(heat); layers["_heat"] = new L.LayerGroup().addLayer(heat);
overlays["heatmap"] = layers["_heat"]; overlays["heatmap"] = layers["_heat"];
} }
@ -1276,6 +1280,9 @@ var delMarker = function(dname,note) {
delete polygons[dname+"_"]; delete polygons[dname+"_"];
} }
if (typeof markers[dname] != "undefined") { if (typeof markers[dname] != "undefined") {
if (heat && markers[dname].hasOwnProperty("_latlng")) {
heat.delLatLng(markers[dname]._latlng);
}
layers[markers[dname].lay].removeLayer(markers[dname]); layers[markers[dname].lay].removeLayer(markers[dname]);
map.removeLayer(markers[dname]); map.removeLayer(markers[dname]);
delete markers[dname]; delete markers[dname];
@ -1333,7 +1340,6 @@ var rangerings = function(latlng, options) {
// the MAIN add something to map function // the MAIN add something to map function
function setMarker(data) { function setMarker(data) {
var rightmenu = function(m) { var rightmenu = function(m) {
// customise right click context menu // customise right click context menu
var rightcontext = ""; var rightcontext = "";