diff --git a/CHANGELOG.md b/CHANGELOG.md index bc81923..f319317 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.5.0 - Add minimap capability. - v2.4.2 - Fix editing injected shapes. - v2.4.1 - Add convex-hull node for grouping objects. - v2.3.16 - Add heading to default addMarker, allow custom http icon size. diff --git a/README.md b/README.md index 0ba87d2..7f07831 100644 --- a/README.md +++ b/README.md @@ -445,6 +445,23 @@ may let you markers be more visible. (see overlay example below). "opt":{ "maxZoom":19, "attribution":"© OpenStreetMap" } }; +#### To add a minimap + +A minimap overview can be added by sending a suitable command. The "minimap" property +must specify the name of an existing base layer to use. The "opt" property can contain +valid options from the [minimap library options](https://github.com/Norkart/Leaflet-MiniMap#available-options). + + msg.payload.command.map = { + minimap: "OSM", + opt: { + centerFixed: [51.05, -1.35], + toggleDisplay: true + } + } + }; + +Set `msg.payload.command.map.minimap = false;` to remove the minimap. + #### To remove base or overlay layers To remove several layers, either base layers or overlays, you can pass an array of names as follows. diff --git a/examples/Add Minimap.json b/examples/Add Minimap.json new file mode 100644 index 0000000..d618429 --- /dev/null +++ b/examples/Add Minimap.json @@ -0,0 +1 @@ +[{"id":"fd654fbf.7e7db","type":"worldmap","z":"846d7832.3348c8","name":"","lat":"","lon":"","zoom":"14","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/worldmap","x":500,"y":540,"wires":[]},{"id":"3a9f5292.247a0e","type":"inject","z":"846d7832.3348c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":130,"y":540,"wires":[["e5161e3c.df6a1"]]},{"id":"e5161e3c.df6a1","type":"function","z":"846d7832.3348c8","name":"Add minimap","func":"msg.payload = {\n command: {\n map: {\n minimap: \"OSM\",\n opt: {\n \t\t\tcenterFixed: [51.05, -1.35],\n \t\t\ttoggleDisplay: true\n \t\t}\n }\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":540,"wires":[["fd654fbf.7e7db"]]},{"id":"ebe0f256.5a1b7","type":"inject","z":"846d7832.3348c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":130,"y":580,"wires":[["a7e940a5.a24b6"]]},{"id":"a7e940a5.a24b6","type":"function","z":"846d7832.3348c8","name":"Remove minimap","func":"msg.payload = {\n command: {\n map: {\n minimap: false\n }\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":580,"wires":[["fd654fbf.7e7db"]]}] \ No newline at end of file diff --git a/package.json b/package.json index 20ac75b..2528149 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.4.2", + "version": "2.5.0", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "cgi": "0.3.1", "compression": "^1.7.4", "express": "^4.16.4", - "sockjs": "~0.3.20" + "sockjs": "~0.3.21" }, "repository": { "type": "git", diff --git a/worldmap.html b/worldmap.html index 05d20b9..823982c 100644 --- a/worldmap.html +++ b/worldmap.html @@ -54,36 +54,36 @@
⌘⇧m
- ctrl-shift-m
will load the m