Send marker click to websocket

to close #56
This commit is contained in:
Dave Conway-Jones 2018-11-17 12:10:46 +00:00
parent d77c6e70ec
commit e68f71d9c1
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
6 changed files with 11 additions and 13 deletions

View File

@ -1,6 +1,7 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v1.5.11 - Let search also try geocoding lookup if not marks found. - v1.5.12 - Send click message to websocket on marker click - Issue #56
- v1.5.11 - Let search also try geocoding lookup if not found in marks.
- v1.5.10 - Allow latest mark added to open popup, and allow `popped=false` to close. - v1.5.10 - Allow latest mark added to open popup, and allow `popped=false` to close.
- v1.5.7 - Tidy up sidc entry, and drag-ability of nodes on drawing layer. - v1.5.7 - Tidy up sidc entry, and drag-ability of nodes on drawing layer.
- v1.5.6 - Add search command and clear search functionality. - v1.5.6 - Add search command and clear search functionality.

View File

@ -9,7 +9,8 @@ map web page for plotting "things" on.
### Updates ### Updates
- v1.5.11 - Let search also try geocoding lookup if not marks found. - v1.5.12 - Send click message to websocket on marker click - Issue #56
- v1.5.11 - Let search also try geocoding lookup if not found in marks.
- v1.5.10 - Allow latest mark added to open popup, and allow `popped=false` to close. - v1.5.10 - Allow latest mark added to open popup, and allow `popped=false` to close.
- v1.5.7 - Tidy up sidc entry, and drag-ability of nodes on drawing layer. - v1.5.7 - Tidy up sidc entry, and drag-ability of nodes on drawing layer.
- v1.5.6 - Add search command and clear search functionality. - v1.5.6 - Add search command and clear search functionality.
@ -19,14 +20,7 @@ map web page for plotting "things" on.
- v1.5.2 - Make manually added icons moveable by default. - v1.5.2 - Make manually added icons moveable by default.
- v1.5.0 - Add multi-map capability - can now have multiple map endpoints. - v1.5.0 - Add multi-map capability - can now have multiple map endpoints.
- Also add built-in world countries overlay layer for offline use. - Also add built-in world countries overlay layer for offline use.
- v1.4.6 - allow more variation in fa-icon modifiers, so fa-3x and fa-spin work. - ...
- v1.4.5 - fix clearing overlays
- v1.4.4 - add a couple of extra overlay layers, roads, rail, sea
- v1.4.3 - support custom icon for GPX and KML. Better readme for geojson.
- v1.4.2 - add NVG layer capability
- v1.4.1 - let `msg.payload.popup` set the popup contents.
- v1.4.0 - only send to specific \_sessionid if specified.
- ...
see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list. see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list.

View File

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

@ -190,7 +190,7 @@ then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the m
outputs:1, outputs:1,
icon: "white-globe.png", icon: "white-globe.png",
label: function() { label: function() {
return this.name||"world map"; return this.name||this.path.substr(1)||"world map";
}, },
labelStyle: function() { labelStyle: function() {
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";

View File

@ -1272,6 +1272,9 @@ function setMarker(data) {
rightmenuMarker.setLatLng(e.latlng); rightmenuMarker.setLatLng(e.latlng);
map.openPopup(rightmenuMarker); map.openPopup(rightmenuMarker);
}); });
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))}));
});
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); }
} }

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# date: Nov 9th 2018 - v1.5.11 # date: Nov 9th 2018 - v1.5.12
CACHE: CACHE:
index.html index.html