Let clickable property also work for markers

This commit is contained in:
Dave Conway-Jones 2023-03-26 15:06:10 +01:00
parent 54d855b4c2
commit 8627c03a2f
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
4 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.35.0 - Let clickable:false work for markers as well.
- v2.34.0 - Let icon "url" be a local fixed path (PR #223)
- v2.33.0 - Let shapes create click event. (from PR #221)
Fix heatmap delete point bug. Issue #222

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates
- v2.35.0 - Let clickable:false work for markers as well.
- v2.34.0 - Let icon "url" be a local fixed path (PR #223)
- v2.33.0 - Let shapes create click event. (from PR #221)
Fix heatmap delete point bug. Issue #222
@ -67,6 +68,7 @@ Optional properties include
- **weblink** : adds a link to an external page. Either set a url as a *string*, or an *object* like `{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"}`, or multiple links with an *array of objects* `[{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"},{"name":"node-red", "url":"https://nodered.org", "target":"_new"}]`
- **addtoheatmap** : set to <i>false</i> to exclude point from contributing to the heatmap layer. (default true)
- **intensity** : set to a value of 0.1 - 1.0 to set the intensity of the point on the heatmap layer. (default 1.0)
- **clickable** : Default true. Setting to false disables showing any popup.
- **popped** : set to true to automatically open the popup info box, set to false to close it.
- **popup** : html to fill the popup if you don't want the automatic default of the properties list. Using this overrides photourl, videourl and weblink options.
- **label** : displays the contents as a permanent label next to the marker, or

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "2.34.0",
"version": "2.35.0",
"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",

View File

@ -2024,12 +2024,11 @@ function setMarker(data) {
if (data.fill) { delete data.fill; }
if (data.draggable) { delete data.draggable; }
//if (!isNaN(data.speed)) { data.speed = data.speed.toFixed(2); }
if (data.hasOwnProperty("clickable")) { delete data.clickable; }
if (data.hasOwnProperty("fillColor")) { delete data.fillColor; }
if (data.hasOwnProperty("radius")) { delete data.radius; }
if (data.hasOwnProperty("greatcircle")) { delete data.greatcircle; }
for (var i in data) {
if ((i != "name") && (i != "length")) {
if ((i != "name") && (i != "length") && (i != "clickable")) {
if (typeof data[i] === "object") {
words += i +" : "+JSON.stringify(data[i])+"<br/>";
} else {
@ -2042,8 +2041,10 @@ function setMarker(data) {
words = "<b>"+data.name+"</b><br/>" + words; //"<button style=\"border-radius:4px; float:right; background-color:lightgrey;\" onclick='popped=false;popmark.closePopup();'>X</button><br/>" + words;
var wopt = {autoClose:false, closeButton:true, closeOnClick:false, minWidth:200};
if (words.indexOf('<video ') >=0 || words.indexOf('<img ') >=0 ) { wopt.maxWidth="640"; }
marker.bindPopup(words, wopt);
marker._popup.dname = data.name;
if (!data.hasOwnProperty("clickable") && data.clickable != false) {
marker.bindPopup(words, wopt);
marker._popup.dname = data.name;
}
marker.lay = lay; // and the layer it is on
// marker.on('click', function(e) {