better feedback of clicks and moves

This commit is contained in:
Dave Conway-Jones 2021-10-21 22:57:51 +01:00
parent 32f74a25ab
commit fef76473c3
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
6 changed files with 23 additions and 21 deletions

View File

@ -1,16 +1,17 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.17.3 - Yet more better feedback on clicks, moves.
- v2.17.2 - Add smallplane icon. - v2.17.2 - Add smallplane icon.
- v2.17.1 - More complete feedback on click, better popup image sizing. - v2.17.1 - 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 kmz objects.
- v2.16.0 - Allow specifying custom base map server. - v2.16.0 - Allow specifying custom base map server.
- v2.15.8 - Adjust ui check timing for UI worldmap. - v2.15.8 - Adjust ui check timing for UI worldmap.
- v2.15.7 - Tidy up geoJson handling a bit more. - v2.15.7 - Tidy up geoJson handling a bit more.
- v2.15.5 - Fix SIDC icons to accept unicoded icons as labels. - v2.15.5 - Fix SIDC icons to accept unicoded icons as labels.
- v2.15.4 - Let clear heatmap command do what it says. - v2.15.4 - Let clear heatmap command do what it says.
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments. - v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.
- v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s. - v2.15.0 - Let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s.
- v2.14.0 - Let geojson features be clickable if added as overlay. - v2.14.0 - Let geojson features be clickable if added as overlay.
- v2.13.4 - Fix list of map choices to be in sync. Fix popup auto sizing. - v2.13.4 - Fix list of map choices to be in sync. Fix popup auto sizing.
- v2.13.3 - Fix unchanged layer propagation. - v2.13.3 - Fix unchanged layer propagation.

View File

@ -11,17 +11,18 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.17.3 - Yet more better feedback on clicks, moves.
- v2.17.2 - Add smallplane icon. - v2.17.2 - Add smallplane icon.
- v2.17.1 - More complete feedback on click, better popup image sizing. - v2.17.1 - 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 kmz objects.
- v2.16.0 - Allow specifying custom base map server. - v2.16.0 - Allow specifying custom base map server.
- v2.15.8 - Adjust ui check timing for UI worldmap. - v2.15.8 - Adjust ui check timing for UI worldmap.
- v2.15.7 - Tidy up geoJson handling a bit more. - v2.15.7 - Tidy up geoJson handling a bit more.
- v2.15.5 - Fix SIDC icons to accept unicoded icons as labels. - v2.15.5 - Fix SIDC icons to accept unicoded icons as labels.
- v2.15.4 - Let clear heatmap command do what it says. - v2.15.4 - Let clear heatmap command do what it says.
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments. - v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.
- v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s. - v2.15.0 - Let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s.
- v2.14.0 - Let geojson features be clickable if added as overlay. - v2.14.0 - Let geojson features be clickable if added as overlay.
- v2.13.4 - Fix list of map choices to be in sync. Fix popup auto sizing. - v2.13.4 - Fix list of map choices to be in sync. Fix popup auto sizing.
- v2.13.3 - Fix unchanged layer propagation. - v2.13.3 - Fix unchanged layer propagation.

View File

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

@ -45,6 +45,7 @@ module.exports = function(RED) {
var sockPath = path.posix.join(RED.settings.httpNodeRoot,node.path,'socket'); var sockPath = path.posix.join(RED.settings.httpNodeRoot,node.path,'socket');
sockets[node.path] = sockjs.createServer({prefix:sockPath, sockjs_url:libPath, log:function() { return; }}); sockets[node.path] = sockjs.createServer({prefix:sockPath, sockjs_url:libPath, log:function() { return; }});
sockets[node.path].installHandlers(RED.server); sockets[node.path].installHandlers(RED.server);
sockets[node.path].on('error', function(e) { node.error("Socket Connection Error: "+e.stack); });
} }
//node.log("Serving "+__dirname+" as "+node.path); //node.log("Serving "+__dirname+" as "+node.path);
node.log("started at "+node.path); node.log("started at "+node.path);

File diff suppressed because one or more lines are too long

View File

@ -76,6 +76,7 @@ if (typeof Object.assign !== 'function') {
// Create the socket // Create the socket
var connect = function() { var connect = function() {
// var transports = ["websocket", "xhr-streaming", "xhr-polling"],
ws = new SockJS(location.pathname.split("index")[0] + 'socket'); ws = new SockJS(location.pathname.split("index")[0] + 'socket');
ws.onopen = function() { ws.onopen = function() {
console.log("CONNECTED"); console.log("CONNECTED");
@ -1764,19 +1765,13 @@ function setMarker(data) {
var b = marker.getPopup().getContent().split("heading : "); var b = marker.getPopup().getContent().split("heading : ");
if (b.length === 2) { b = parseFloat(b[1].split("<br")[0]); } if (b.length === 2) { b = parseFloat(b[1].split("<br")[0]); }
else { b = undefined; } else { b = undefined; }
ws.send(JSON.stringify({
action:"move", var fb = allData[marker.name];
name:marker.name, fb.action = "move";
layer:marker.lay, fb.lat = parseFloat(marker.getLatLng().lat.toFixed(6));
lat:parseFloat(marker.getLatLng().lat.toFixed(6)), fb.lon = parseFloat(marker.getLatLng().lng.toFixed(6));
lon:parseFloat(marker.getLatLng().lng.toFixed(6)), fb.from = oldll;
hdg:b, ws.send(JSON.stringify(fb));
icon:marker.icon,
iconColor:marker.iconColor,
SIDC:marker.SIDC,
draggable:true,
from:oldll
}));
}); });
} }
@ -1910,7 +1905,10 @@ function setMarker(data) {
marker.lay = lay; // and the layer it is on marker.lay = lay; // and the layer it is on
marker.on('click', function(e) { marker.on('click', function(e) {
ws.send(JSON.stringify({action:"click",name:marker.name,layer:marker.lay,icon:marker.icon,iconColor:marker.iconColor,SIDC:marker.SIDC,draggable:true,lat:parseFloat(marker.getLatLng().lat.toFixed(6)),lon:parseFloat(marker.getLatLng().lng.toFixed(6))})); //ws.send(JSON.stringify({action:"click",name:marker.name,layer:marker.lay,icon:marker.icon,iconColor:marker.iconColor,SIDC:marker.SIDC,draggable:true,lat:parseFloat(marker.getLatLng().lat.toFixed(6)),lon:parseFloat(marker.getLatLng().lng.toFixed(6))}));
var fb = allData[marker.name];
fb.action = "click";
ws.send(JSON.stringify(fb));
}); });
if ((data.addtoheatmap !== "false") || (!data.hasOwnProperty("addtoheatmap"))) { // Added to give ability to control if points from active layer contribute to heatmap if ((data.addtoheatmap !== "false") || (!data.hasOwnProperty("addtoheatmap"))) { // Added to give ability to control if points from active layer contribute to heatmap
if (heatAll || map.hasLayer(layers[lay])) { heat.addLatLng(lli); } if (heatAll || map.hasLayer(layers[lay])) { heat.addLatLng(lli); }