Add clickToApply flag to suggestion

This commit is contained in:
Nick O'Leary
2025-06-17 10:41:32 +01:00
parent d9715eab99
commit af0903eae1

View File

@@ -4762,6 +4762,10 @@ RED.view = (function() {
.on("touchend",nodeTouchEnd)
.on("mouseover",nodeMouseOver)
.on("mouseout",nodeMouseOut);
} else if (d.__ghostClick) {
d3.select(mainRect)
.on("mousedown",d.__ghostClick)
.on("touchstart",d.__ghostClick)
}
nodeContents.appendChild(mainRect);
//node.append("rect").attr("class", "node-gradient-top").attr("rx", 6).attr("ry", 6).attr("height",30).attr("stroke","none").attr("fill","url(#gradient-top)").style("pointer-events","none");
@@ -5004,6 +5008,10 @@ RED.view = (function() {
.on("mouseover",function(d){portMouseOver(d3.select(this),d,PORT_TYPE_INPUT,0);})
.on("mouseout",function(d) {portMouseOut(d3.select(this),d,PORT_TYPE_INPUT,0);});
RED.hooks.trigger("viewAddPort",{node:d,el: this, port: inputGroup[0][0], portType: "input", portIndex: 0})
} else if (d.__ghostClick) {
inputGroupPorts
.on("mousedown",d.__ghostClick)
.on("touchstart",d.__ghostClick)
}
}
var numOutputs = d.outputs;
@@ -5062,6 +5070,9 @@ RED.view = (function() {
portPort.addEventListener("touchend", portTouchEndProxy);
portPort.addEventListener("mouseover", portMouseOverProxy);
portPort.addEventListener("mouseout", portMouseOutProxy);
} else if (d.__ghostClick) {
portPort.addEventListener("mousedown", d.__ghostClick)
portPort.addEventListener("touchstart", d.__ghostClick)
}
this.appendChild(portGroup);
@@ -5363,6 +5374,10 @@ RED.view = (function() {
}
}
})
} else if (d.__ghostClick) {
d3.select(pathBack)
.on("mousedown",d.__ghostClick)
.on("touchstart",d.__ghostClick)
}
var pathOutline = document.createElementNS("http://www.w3.org/2000/svg","path");
@@ -6556,6 +6571,11 @@ RED.view = (function() {
node.id = nodeConfig.id || node.id
node.__ghost = true;
node.dirty = true;
if (suggestion.clickToApply) {
node.__ghostClick = function () {
applySuggestedFlow()
}
}
nodeMap[node.id] = node
if (nodeConfig.wires) {