mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	All node button to be clicked via api call
This commit is contained in:
		@@ -3060,7 +3060,9 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function nodeButtonClicked(d) {
 | 
					    function nodeButtonClicked(d) {
 | 
				
			||||||
        if (mouse_mode === RED.state.SELECTING_NODE) {
 | 
					        if (mouse_mode === RED.state.SELECTING_NODE) {
 | 
				
			||||||
            d3.event.stopPropagation();
 | 
					            if (d3.event) {
 | 
				
			||||||
 | 
					                d3.event.stopPropagation();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        var activeWorkspace = RED.workspaces.active();
 | 
					        var activeWorkspace = RED.workspaces.active();
 | 
				
			||||||
@@ -3087,7 +3089,9 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
 | 
				
			|||||||
                RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
 | 
					                RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        d3.event.preventDefault();
 | 
					        if (d3.event) {
 | 
				
			||||||
 | 
					            d3.event.preventDefault();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function showTouchMenu(obj,pos) {
 | 
					    function showTouchMenu(obj,pos) {
 | 
				
			||||||
@@ -4660,42 +4664,44 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
 | 
				
			|||||||
                RED.workspaces.show(id);
 | 
					                RED.workspaces.show(id);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                var node = RED.nodes.node(id);
 | 
					                var node = RED.nodes.node(id);
 | 
				
			||||||
                if (node._def.category !== 'config' && node.z) {
 | 
					                if (node) {
 | 
				
			||||||
                    node.highlighted = true;
 | 
					                    if (node._def.category !== 'config' && node.z) {
 | 
				
			||||||
                    node.dirty = true;
 | 
					                        node.highlighted = true;
 | 
				
			||||||
                    RED.workspaces.show(node.z);
 | 
					                        node.dirty = true;
 | 
				
			||||||
 | 
					                        RED.workspaces.show(node.z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var screenSize = [chart.width()/scaleFactor,chart.height()/scaleFactor];
 | 
					                        var screenSize = [chart.width()/scaleFactor,chart.height()/scaleFactor];
 | 
				
			||||||
                    var scrollPos = [chart.scrollLeft()/scaleFactor,chart.scrollTop()/scaleFactor];
 | 
					                        var scrollPos = [chart.scrollLeft()/scaleFactor,chart.scrollTop()/scaleFactor];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (node.x < scrollPos[0] || node.y < scrollPos[1] || node.x > screenSize[0]+scrollPos[0] || node.y > screenSize[1]+scrollPos[1]) {
 | 
					                        if (node.x < scrollPos[0] || node.y < scrollPos[1] || node.x > screenSize[0]+scrollPos[0] || node.y > screenSize[1]+scrollPos[1]) {
 | 
				
			||||||
                        var deltaX = '-='+(((scrollPos[0] - node.x) + screenSize[0]/2)*scaleFactor);
 | 
					                            var deltaX = '-='+(((scrollPos[0] - node.x) + screenSize[0]/2)*scaleFactor);
 | 
				
			||||||
                        var deltaY = '-='+(((scrollPos[1] - node.y) + screenSize[1]/2)*scaleFactor);
 | 
					                            var deltaY = '-='+(((scrollPos[1] - node.y) + screenSize[1]/2)*scaleFactor);
 | 
				
			||||||
                        chart.animate({
 | 
					                            chart.animate({
 | 
				
			||||||
                            scrollLeft: deltaX,
 | 
					                                scrollLeft: deltaX,
 | 
				
			||||||
                            scrollTop: deltaY
 | 
					                                scrollTop: deltaY
 | 
				
			||||||
                        },200);
 | 
					                            },200);
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (!node._flashing) {
 | 
					 | 
				
			||||||
                        node._flashing = true;
 | 
					 | 
				
			||||||
                        var flash = 22;
 | 
					 | 
				
			||||||
                        var flashFunc = function() {
 | 
					 | 
				
			||||||
                            flash--;
 | 
					 | 
				
			||||||
                            node.dirty = true;
 | 
					 | 
				
			||||||
                            if (flash >= 0) {
 | 
					 | 
				
			||||||
                                node.highlighted = !node.highlighted;
 | 
					 | 
				
			||||||
                                setTimeout(flashFunc,100);
 | 
					 | 
				
			||||||
                            } else {
 | 
					 | 
				
			||||||
                                node.highlighted = false;
 | 
					 | 
				
			||||||
                                delete node._flashing;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            RED.view.redraw();
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        flashFunc();
 | 
					
 | 
				
			||||||
 | 
					                        if (!node._flashing) {
 | 
				
			||||||
 | 
					                            node._flashing = true;
 | 
				
			||||||
 | 
					                            var flash = 22;
 | 
				
			||||||
 | 
					                            var flashFunc = function() {
 | 
				
			||||||
 | 
					                                flash--;
 | 
				
			||||||
 | 
					                                node.dirty = true;
 | 
				
			||||||
 | 
					                                if (flash >= 0) {
 | 
				
			||||||
 | 
					                                    node.highlighted = !node.highlighted;
 | 
				
			||||||
 | 
					                                    setTimeout(flashFunc,100);
 | 
				
			||||||
 | 
					                                } else {
 | 
				
			||||||
 | 
					                                    node.highlighted = false;
 | 
				
			||||||
 | 
					                                    delete node._flashing;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                                RED.view.redraw();
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            flashFunc();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    } else if (node._def.category === 'config') {
 | 
				
			||||||
 | 
					                        RED.sidebar.config.show(id);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else if (node._def.category === 'config') {
 | 
					 | 
				
			||||||
                    RED.sidebar.config.show(id);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@@ -4776,6 +4782,11 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
 | 
				
			|||||||
        scroll: function(x,y) {
 | 
					        scroll: function(x,y) {
 | 
				
			||||||
            chart.scrollLeft(chart.scrollLeft()+x);
 | 
					            chart.scrollLeft(chart.scrollLeft()+x);
 | 
				
			||||||
            chart.scrollTop(chart.scrollTop()+y)
 | 
					            chart.scrollTop(chart.scrollTop()+y)
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        clickNodeButton: function(n) {
 | 
				
			||||||
 | 
					            if (n._def.button) {
 | 
				
			||||||
 | 
					                nodeButtonClicked(n);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user