1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

improve flashing of node

sometimes node highlight get stuck
This commit is contained in:
Steve-Mcl 2022-05-08 14:24:30 +01:00
parent d1b74675d9
commit 0f2420576a

View File

@ -5853,27 +5853,26 @@ RED.view = (function() {
if(typeof node === "string") { node = RED.nodes.node(n); } if(typeof node === "string") { node = RED.nodes.node(n); }
if(!node) { return; } if(!node) { return; }
const flashingNode = flashingNodeTimer && flashingNodeId && RED.nodes.node(flashingNodeId); const flashingNode = flashingNodeId && RED.nodes.node(flashingNodeId);
if(flashingNode) { if(flashingNode) {
//cancel current flashing node before flashing new node //cancel current flashing node before flashing new node
clearInterval(flashingNodeTimer); clearInterval(flashingNode.__flashTimer);
flashingNodeTimer = null; delete flashingNode.__flashTimer;
flashingNode.dirty = true; flashingNode.dirty = true;
flashingNode.highlighted = false; flashingNode.highlighted = false;
} }
node.__flashTimer = setInterval(function(flashEndTime, n) {
flashingNodeTimer = setInterval(function(flashEndTime) { n.dirty = true;
node.dirty = true;
if (flashEndTime >= Date.now()) { if (flashEndTime >= Date.now()) {
node.highlighted = !node.highlighted; n.highlighted = !n.highlighted;
} else { } else {
clearInterval(flashingNodeTimer); clearInterval(__flashTimer);
flashingNodeTimer = null; delete n.__flashTimer;
node.highlighted = false;
flashingNodeId = null; flashingNodeId = null;
n.highlighted = false;
} }
RED.view.redraw(); RED.view.redraw();
}, 100, Date.now() + 2200) }, 100, Date.now() + 2200, node)
flashingNodeId = node.id; flashingNodeId = node.id;
node.highlighted = true; node.highlighted = true;
RED.view.redraw(); RED.view.redraw();