All node button to be clicked via api call

This commit is contained in:
Nick O'Leary 2020-04-27 11:03:43 +01:00
parent d9f710aa52
commit 1a9c4b7714
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 45 additions and 34 deletions

View File

@ -3060,7 +3060,9 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
function nodeButtonClicked(d) {
if (mouse_mode === RED.state.SELECTING_NODE) {
if (d3.event) {
d3.event.stopPropagation();
}
return;
}
var activeWorkspace = RED.workspaces.active();
@ -3087,8 +3089,10 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
}
}
if (d3.event) {
d3.event.preventDefault();
}
}
function showTouchMenu(obj,pos) {
var mdn = mousedown_node;
@ -4660,6 +4664,7 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
RED.workspaces.show(id);
} else {
var node = RED.nodes.node(id);
if (node) {
if (node._def.category !== 'config' && node.z) {
node.highlighted = true;
node.dirty = true;
@ -4698,6 +4703,7 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
RED.sidebar.config.show(id);
}
}
}
},
gridSize: function(v) {
if (v === undefined) {
@ -4776,6 +4782,11 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); }
scroll: function(x,y) {
chart.scrollLeft(chart.scrollLeft()+x);
chart.scrollTop(chart.scrollTop()+y)
},
clickNodeButton: function(n) {
if (n._def.button) {
nodeButtonClicked(n);
}
}
};
})();