mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-08-15 22:36:40 +08:00
set/get tweaks
This commit is contained in:
parent
473ea60f78
commit
6cb0e8e334
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ __pycache__
|
|||||||
*.pth
|
*.pth
|
||||||
types
|
types
|
||||||
models
|
models
|
||||||
|
jsconfig.json
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { app } from "../../../scripts/app.js";
|
import { app } from "../../../scripts/app.js";
|
||||||
import { ComfyWidgets } from '../../../scripts/widgets.js';
|
|
||||||
//based on diffus3's SetGet: https://github.com/diffus3/ComfyUI-extensions
|
//based on diffus3's SetGet: https://github.com/diffus3/ComfyUI-extensions
|
||||||
|
|
||||||
// Nodes that allow you to tunnel connections for cleaner graphs
|
// Nodes that allow you to tunnel connections for cleaner graphs
|
||||||
@ -243,18 +243,10 @@ app.registerExtension({
|
|||||||
|
|
||||||
content: `${getter.title} id: ${getter.id}`,
|
content: `${getter.title} id: ${getter.id}`,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
if (this.canvas?.ds?.offset) {
|
this.canvas.centerOnNode(getter);
|
||||||
const nodeCenterX = getter.pos[0] + (getter.size[0] / 2);
|
this.canvas.selectNode(getter, false);
|
||||||
const nodeCenterY = getter.pos[1] + (getter.size[1] / 2);
|
|
||||||
|
|
||||||
this.canvas.ds.offset[0] = -nodeCenterX + this.canvas.mouse[0];
|
|
||||||
this.canvas.ds.offset[1] = -nodeCenterY + this.canvas.mouse[1];
|
|
||||||
}
|
|
||||||
if (this.canvas?.ds?.scale != null) {
|
|
||||||
this.canvas.ds.scale = Number(1);
|
|
||||||
}
|
|
||||||
this.canvas.selectNode(getter, false)
|
|
||||||
this.canvas.setDirty(true, true);
|
this.canvas.setDirty(true, true);
|
||||||
|
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -438,18 +430,8 @@ app.registerExtension({
|
|||||||
|
|
||||||
this.goToSetter = function() {
|
this.goToSetter = function() {
|
||||||
const setter = this.findSetter(this.graph);
|
const setter = this.findSetter(this.graph);
|
||||||
if (this.canvas?.ds?.offset) {
|
this.canvas.centerOnNode(setter);
|
||||||
const nodeCenterX = setter.pos[0] + (setter.size[0] / 2);
|
this.canvas.selectNode(setter, false);
|
||||||
const nodeCenterY = setter.pos[1] + (setter.size[1] / 2);
|
|
||||||
|
|
||||||
this.canvas.ds.offset[0] = -nodeCenterX + this.canvas.mouse[0];
|
|
||||||
this.canvas.ds.offset[1] = -nodeCenterY + this.canvas.mouse[1];
|
|
||||||
}
|
|
||||||
if (this.canvas?.ds?.scale != null) {
|
|
||||||
this.canvas.ds.scale = Number(1);
|
|
||||||
}
|
|
||||||
this.canvas.selectNode(setter, false)
|
|
||||||
this.canvas.setDirty(true, true);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// This node is purely frontend and does not impact the resulting prompt so should not be serialized
|
// This node is purely frontend and does not impact the resulting prompt so should not be serialized
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user