bartbutenaers / node-red-contrib-ui-svg

A Node-RED widget node to show interactive SVG (vector graphics) in the dashboard
Apache License 2.0
94 stars 27 forks source link

Animations start automatically #7

Closed bartbutenaers closed 4 years ago

bartbutenaers commented 5 years ago

Sometimes the animations start automatically, even when their trigger is 'msg' (which means only an input message can start them).

Steps to reproduce:

  1. Send an input message to start the animation.
  2. Refresh the browser screen to restart the dashboard webapp
  3. Then the animation starts automatically.

[EDIT] Perhaps it is related to this discussion on the forum. Currently we have storeFrontEndInputAsState=false (here). Hopefully setting this boolean to true fixes our problem.

bartbutenaers commented 4 years ago

@Steve-Mcl Based on HotNipi's feedback perhaps we can do it like this:

$scope.$watch('msg', function(msg) {
   // Ignore undefined messages.
   if (!msg) {
      return;
   }

   // Avoid messages being handled twice.  Otherwise messages will be replayed after a deploy, causing animations to be started automatically
   if (msg.alreadyHandled) {
      return;
   }

   msg.alreadyHandled = true;

Have not checked yet whether this works, i.e. whether our msg.alreadyHandled field is being stored by Node-RED. Moreover HotNipi talks about a timestamp, so perhaps we really need to allow the same message to be handled multiple times during a short time interval???

ipamaas commented 4 years ago

This project is great! It would be really helpful if to get this fixed! Thank you!

bartbutenaers commented 4 years ago

Hi Matthias (@ipamaas), Is this still a problem in the latest versions? Was pretty sure that this would be solved, since we don't replay messages anymore. Same steps as described above?

bartbutenaers commented 4 years ago

Matthias, I'm totally confused. The message replaying has been fixed for the uocoming 2.0.0 release. Could you please install that directly from github and let me know if it is solved:

npm install bartbutenaers/node-red-contrib-ui-svg#panzoom

Thanks! Bart

ipamaas commented 4 years ago

Hi Bart,

the problem seems to be gone with

npm install bartbutenaers/node-red-contrib-ui-svg#panzoom

Thank you for the hint, was using the recent one from npmjs before.

Best regards Matthias

bartbutenaers commented 4 years ago

Thanks for your feedback! The 2.0.0 release is almost ready for release on npm. Just need to find some time to finalize the last bits ...