Rework context menu options for getter nodes.

This commit is contained in:
Austin Mroz 2025-10-18 09:43:10 -07:00
parent 3af232e755
commit 774fca9129
No known key found for this signature in database

View File

@ -470,9 +470,8 @@ app.registerExtension({
};
this.goToSetter = function() {
const setter = this.findSetter(this.graph);
this.canvas.centerOnNode(setter);
this.canvas.selectNode(setter, false);
this.canvas.centerOnNode(this.currentSetter);
this.canvas.selectNode(this.currentSetter, false);
};
// This node is purely frontend and does not impact the resulting prompt so should not be serialized
@ -496,7 +495,8 @@ app.registerExtension({
}
getExtraMenuOptions(_, options) {
let menuEntry = this.drawConnection ? "Hide connections" : "Show connections";
this.currentSetter = this.findSetter(this.graph)
if (!this.currentSetter) return
options.unshift(
{
content: "Go to setter",
@ -507,12 +507,9 @@ app.registerExtension({
{
content: menuEntry,
callback: () => {
this.currentSetter = this.findSetter(this.graph);
if (this.currentSetter.length == 0) return;
let linkType = (this.currentSetter.inputs[0].type);
let linkType = (this.currentSetter.inputs[0].type);
this.drawConnection = !this.drawConnection;
this.slotColor = this.canvas.default_connection_color_byType[linkType]
menuEntry = this.drawConnection ? "Hide connections" : "Show connections";
this.canvas.setDirty(true, true);
},
},