In another discussion we had an agreement to send a msg.event property on some of the UI nodes. So I also implemented that change in version 2.0.0 of the SVG node, which is not on NPM yet (which will be released this week)!
However the ContextMenu node searched its coordinates in the msg.position (hardcoded), instead of in ``msg.event`. To avoid that everybody needs to add Change nodes all over the place (to move the message fields), version 2.0.0 of the ContextMenu node has following changes:
It is possible to specify the X and Y coordinate values separately, as fixed coordinate value or as a specified input message field:
The menu can now also be delivered in any specified input message field:
Or fixed as before:
The readme file contains more examples and flows. I have also added the demo from @Paul-Reed to the readme, because it demonstrates nicely how the node can be used without the SVG node. Thanks Paul!
The example flows are now available via the flow editor "Import" menu:
The input messages are now validated on the server side, which allows me to show some validation errors in the debug panel.
Would be nice if somebody could install this new version from Github, and test it:
I tried the context_menu_for_button example and - please remember that I am new to all this and lacking in understanding bunches of stuff - the help says that the output msg.sourceMsg will contain the original input message but the output I get is the x & y position from the input position object and _ui_cm_already_seen: true which is definitely not what I see as the source msg.
Would it be possible to explain how this should be used. (The basic outputs are obvious even to me )
Hi Jef (@Buckskin),
Thanks for testing!!! It is lately difficult to find testers, so all help is welcome ...
Seems you found a bug, which had sneaked into this version.
It is now fixed on Github:
Thank you, yep that fixed it. The only other issue I have (and it may not be related) when I installed the node I got this from the log. Any idea on what node-gyp is and why there should be all these warnings. The contextmenu node is working fine. If it makes any difference the instance of Node-Red I am using for this is running on Ubuntu 16.04 in a VMWare box on Windows 10
> pi@HomeAutomation:~/.node-red$ npm install bartbutenaers/node-red-contrib-ui-contextmenu
>
> mdns@2.5.1 install /home/pi/.node-red/node_modules/mdns
> node-gyp rebuild
>
> make: Entering directory '/home/pi/.node-red/node_modules/mdns/build'
> CXX(target) Release/obj.target/dns_sd_bindings/src/dns_sd.o
> In file included from ../src/dns_sd.cpp:1:0:
> ../src/mdns.hpp:32:20: fatal error: dns_sd.h: No such file or directory
> compilation terminated.
> dns_sd_bindings.target.mk:168: recipe for target 'Release/obj.target/dns_sd_bindings/src/dns_sd.o' failed
> make: *** [Release/obj.target/dns_sd_bindings/src/dns_sd.o] Error 1
> make: Leaving directory '/home/pi/.node-red/node_modules/mdns/build'
> gyp ERR! build error
> gyp ERR! stack Error: `make` failed with exit code: 2
> gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)
> gyp ERR! stack at ChildProcess.emit (events.js:198:13)
> gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
> gyp ERR! System Linux 4.4.0-185-generic
> gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
> gyp ERR! cwd /home/pi/.node-red/node_modules/mdns
> gyp ERR! node -v v10.21.0
> gyp ERR! node-gyp -v v5.1.0
> gyp ERR! not ok
> npm WARN node-red-contrib-ui-led@0.3.1 requires a peer of node-red-dashboard@2.14.x but none is installed. You must install peer dependencies yourself.
> npm WARN node-red-project@0.0.1 No repository field.
> npm WARN node-red-project@0.0.1 No license field.
> npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mdns@2.5.1 (node_modules/mdns):
> npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mdns@2.5.1 install: `node-gyp rebuild`
> npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
>
> + node-red-contrib-ui-contextmenu@2.0.0
> updated 1 package and audited 1043 packages in 36.708s
>
> 18 packages are looking for funding
> run `npm fund` for details
>
> found 2 low severity vulnerabilities
> run `npm audit fix` to fix them, or `npm audit` for details