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(!node) { return; }
const flashingNode = flashingNodeTimer && flashingNodeId && RED.nodes.node(flashingNodeId);
const flashingNode = flashingNodeId && RED.nodes.node(flashingNodeId);
if(flashingNode) {
//cancel current flashing node before flashing new node
clearInterval(flashingNodeTimer);
flashingNodeTimer = null;
clearInterval(flashingNode.__flashTimer);
delete flashingNode.__flashTimer;
flashingNode.dirty = true;
flashingNode.highlighted = false;
}
flashingNodeTimer = setInterval(function(flashEndTime) {
node.dirty = true;
node.__flashTimer = setInterval(function(flashEndTime, n) {
n.dirty = true;
if (flashEndTime >= Date.now()) {
node.highlighted = !node.highlighted;
n.highlighted = !n.highlighted;
} else {
clearInterval(flashingNodeTimer);
flashingNodeTimer = null;
node.highlighted = false;
clearInterval(__flashTimer);
delete n.__flashTimer;
flashingNodeId = null;
n.highlighted = false;
}
RED.view.redraw();
}, 100, Date.now() + 2200)
}, 100, Date.now() + 2200, node)
flashingNodeId = node.id;
node.highlighted = true;
RED.view.redraw();