more complete feedback on click

better popup image sizing
This commit is contained in:
Dave Conway-Jones 2021-10-12 21:19:00 +01:00
parent 59941f705c
commit 8e98bad30f
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
5 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.17.0 - More complete feedback on click, better popup image sizing.
- v2.16.3 - Ensure polygons can be deleted. - v2.16.3 - Ensure polygons can be deleted.
- v2.16.2 - better handling of unpacked gpz objects. - v2.16.2 - better handling of unpacked gpz objects.
- v2.16.0 - Allow specifying custom base map server. - v2.16.0 - Allow specifying custom base map server.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.17.0 - More complete feedback on click, better popup image sizing.
- v2.16.3 - Ensure polygons can be deleted. - v2.16.3 - Ensure polygons can be deleted.
- v2.16.2 - better handling of unpacked gpz objects. - v2.16.2 - better handling of unpacked gpz objects.
- v2.16.0 - Allow specifying custom base map server. - v2.16.0 - Allow specifying custom base map server.

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "2.16.3", "version": "2.17.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": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

@ -23,6 +23,10 @@ a {
text-decoration:none; text-decoration:none;
} }
.leaflet-interactive:hover {
filter: opacity(0.5);
}
.topbar { .topbar {
font-size:16px; font-size:16px;
vertical-align:middle; vertical-align:middle;

View File

@ -697,8 +697,11 @@ var addThing = function() {
var feedback = function(n,v,a,c) { var feedback = function(n,v,a,c) {
if (v === "$form") { v = form; } if (v === "$form") { v = form; }
if (markers[n]) { if (markers[n]) {
var fp = markers[n]._latlng; //var fp = markers[n]._latlng;
ws.send(JSON.stringify({action:a||"feedback", name:n, value:v, layer:markers[n].lay, lat:fp.lat, lon:fp.lng})); // ws.send(JSON.stringify({action:a||"feedback", name:n, value:v, layer:markers[n].lay, lat:fp.lat, lon:fp.lng}));
var fb = allData[n];
fb.action = a || "feedback";
ws.send(JSON.stringify(fb));
} }
else { else {
if (n === undefined) { n = "map"; } if (n === undefined) { n = "map"; }
@ -1214,7 +1217,7 @@ var rangerings = function(latlng, options) {
ranges: [250,500,750,1000], ranges: [250,500,750,1000],
pan: 0, pan: 0,
fov: 60, fov: 60,
color: '#910000' color: '#aaaa00'
}, options); }, options);
var rings = L.featureGroup(); var rings = L.featureGroup();
if (typeof options.ranges === "number") { options.ranges = [ options.ranges ]; } if (typeof options.ranges === "number") { options.ranges = [ options.ranges ]; }
@ -1702,7 +1705,7 @@ function setMarker(data) {
opts.size = opts.size || sz; opts.size = opts.size || sz;
opts.size = opts.size * (opts.scale || 1); opts.size = opts.size * (opts.scale || 1);
// escape out any isocodes eg flag symbols // escape out any isocodes eg flag symbols
var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation"]; var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed"];
optfields.forEach(function (item) { optfields.forEach(function (item) {
if (opts.hasOwnProperty(item)) { opts[item] = unescape(encodeURIComponent(opts[item])); } if (opts.hasOwnProperty(item)) { opts[item] = unescape(encodeURIComponent(opts[item])); }
}); });
@ -1784,11 +1787,11 @@ function setMarker(data) {
if (data.hasOwnProperty("icon")) { delete data.icon; } if (data.hasOwnProperty("icon")) { delete data.icon; }
if (data.hasOwnProperty("iconColor")) { delete data.iconColor; } if (data.hasOwnProperty("iconColor")) { delete data.iconColor; }
if (data.hasOwnProperty("photourl")) { if (data.hasOwnProperty("photourl")) {
words += "<img src=\"" + data.photourl + "\" style=\"width:100%; margin-top:10px;\">"; words += "<img src=\"" + data.photourl + "\" style=\"max-width:100%; max-height:250px; margin-top:10px;\"><br/>";
delete data.photourl; delete data.photourl;
} }
if (data.hasOwnProperty("photoUrl")) { if (data.hasOwnProperty("photoUrl")) {
words += "<img src=\"" + data.photoUrl + "\" style=\"width:100%; margin-top:10px;\">"; words += "<img src=\"" + data.photoUrl + "\" style=\"max-width:100%; max-height:250px; margin-top:10px;\"><br/>";
delete data.photoUrl; delete data.photoUrl;
} }
if (data.hasOwnProperty("videoUrl")) { if (data.hasOwnProperty("videoUrl")) {