add rightmenu to added shapes

to close #141
This commit is contained in:
Dave Conway-Jones 2020-07-25 17:42:39 +01:00
parent 80a03f99ab
commit 222d4608e6
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
4 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.4.2 - Fix editing injected shapes.
- v2.4.1 - Add convex-hull node for grouping objects. - v2.4.1 - Add convex-hull node for grouping objects.
- v2.3.16 - Add heading to default addMarker, allow custom http icon size. - v2.3.16 - Add heading to default addMarker, allow custom http icon size.
- v2.3.13 - Fix geoson feature properties fill color, and better marker handling - v2.3.13 - Fix geoson feature properties fill color, and better marker handling

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.4.2 - Fix editing injected shapes.
- v2.4.1 - Add convex-hull node for grouping objects. - v2.4.1 - Add convex-hull node for grouping objects.
- v2.3.16 - Add heading to default addMarker, allow custom http icon size. - v2.3.16 - Add heading to default addMarker, allow custom http icon size.
- v2.3.13 - Fix geoson feature properties fill color, and better marker handling - v2.3.13 - Fix geoson feature properties fill color, and better marker handling

View File

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

@ -998,7 +998,7 @@ function setMarker(data) {
if (polygons[data.name] == undefined) { if (polygons[data.name] == undefined) {
rightcontext = "<button id='delbutton' onclick='delMarker(\""+data.name+"\",true);'>Delete</button>"; rightcontext = "<button id='delbutton' onclick='delMarker(\""+data.name+"\",true);'>Delete</button>";
} }
else if (data.editable) { if (data.editable) {
rightcontext = "<button onclick='editPoly(\""+data.name+"\",true);'>Edit</button><button onclick='delMarker(\""+data.name+"\",true);'>Delete</button>"; rightcontext = "<button onclick='editPoly(\""+data.name+"\",true);'>Edit</button><button onclick='delMarker(\""+data.name+"\",true);'>Delete</button>";
} }
if ((data.contextmenu !== undefined) && (typeof data.contextmenu === "string")) { if ((data.contextmenu !== undefined) && (typeof data.contextmenu === "string")) {
@ -1106,19 +1106,19 @@ function setMarker(data) {
if (!data.hasOwnProperty("weight")) { opt.weight = 3; } //Standard settings different for lines if (!data.hasOwnProperty("weight")) { opt.weight = 3; } //Standard settings different for lines
if (!data.hasOwnProperty("opacity")) { opt.opacity = 0.8; } if (!data.hasOwnProperty("opacity")) { opt.opacity = 0.8; }
var polyln = L.polyline(data.line, opt); var polyln = L.polyline(data.line, opt);
polygons[data.name] = polyln; polygons[data.name] = rightmenu(polyln);
} }
else if (data.hasOwnProperty("area") && Array.isArray(data.area)) { else if (data.hasOwnProperty("area") && Array.isArray(data.area)) {
var polyarea; var polyarea;
if (data.area.length === 2) { polyarea = L.rectangle(data.area, opt); } if (data.area.length === 2) { polyarea = L.rectangle(data.area, opt); }
else { polyarea = L.polygon(data.area, opt); } else { polyarea = L.polygon(data.area, opt); }
polygons[data.name] = polyarea; polygons[data.name] = rightmenu(polyarea);
} }
else if (data.hasOwnProperty("sdlat") && data.hasOwnProperty("sdlon")) { else if (data.hasOwnProperty("sdlat") && data.hasOwnProperty("sdlon")) {
if (!data.hasOwnProperty("iconColor")) { opt.color = "blue"; } //different standard Color Settings if (!data.hasOwnProperty("iconColor")) { opt.color = "blue"; } //different standard Color Settings
if (!data.hasOwnProperty("fillColor")) { opt.fillColor = "blue"; } if (!data.hasOwnProperty("fillColor")) { opt.fillColor = "blue"; }
var ellipse = L.ellipse(new L.LatLng((data.lat*1), (data.lon*1)), [200000*data.sdlon*Math.cos(data.lat*Math.PI/180), 200000*data.sdlat], 0, opt); var ellipse = L.ellipse(new L.LatLng((data.lat*1), (data.lon*1)), [200000*data.sdlon*Math.cos(data.lat*Math.PI/180), 200000*data.sdlat], 0, opt);
polygons[data.name] = ellipse; polygons[data.name] = rightmenu(ellipse);
} }
else if (data.hasOwnProperty("radius")) { else if (data.hasOwnProperty("radius")) {
if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) { if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) {
@ -1129,7 +1129,7 @@ function setMarker(data) {
else { else {
polycirc = L.circle(new L.LatLng((data.lat*1), (data.lon*1)), data.radius*1, opt); polycirc = L.circle(new L.LatLng((data.lat*1), (data.lon*1)), data.radius*1, opt);
} }
polygons[data.name] = polycirc; polygons[data.name] = rightmenu(polycirc);
if (!data.hasOwnProperty("icon")) { if (!data.hasOwnProperty("icon")) {
delete (data.lat); delete (data.lat);
delete (data.lon); delete (data.lon);