Merge pull request #417 from AustinMroz/main

Rework context menu options for getter nodes.
This commit is contained in:
Jukka Seppänen 2025-10-18 22:22:54 +03:00 committed by GitHub
commit 405c99ec16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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);
},
},