mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-05-19 12:37:13 +08:00
cleanup
This commit is contained in:
parent
98add2716b
commit
8ccf83fbbf
@ -1,27 +1,23 @@
|
|||||||
import { app } from "../../../scripts/app.js";
|
import { app } from "../../../scripts/app.js";
|
||||||
|
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "KJNodes.appearance",
|
name: "KJNodes.appearance",
|
||||||
nodeCreated(node) {
|
nodeCreated(node) {
|
||||||
const title = node.getTitle();
|
switch (node.comfyClass) {
|
||||||
switch (title) {
|
case "INTConstant":
|
||||||
case "INT Constant":
|
|
||||||
node.setSize([200, 58]);
|
node.setSize([200, 58]);
|
||||||
node.color = "#1b4669";
|
node.color = "#1b4669";
|
||||||
node.bgcolor = "#29699c";
|
node.bgcolor = "#29699c";
|
||||||
break;
|
break;
|
||||||
case "Float Constant":
|
case "FloatConstant":
|
||||||
node.setSize([200, 58]);
|
node.setSize([200, 58]);
|
||||||
node.color = LGraphCanvas.node_colors.green.color;
|
node.color = LGraphCanvas.node_colors.green.color;
|
||||||
node.bgcolor = LGraphCanvas.node_colors.green.bgcolor;
|
node.bgcolor = LGraphCanvas.node_colors.green.bgcolor;
|
||||||
break;
|
break;
|
||||||
case "ConditioningMultiCombine":
|
case "ConditioningMultiCombine":
|
||||||
|
|
||||||
node.color = LGraphCanvas.node_colors.brown.color;
|
node.color = LGraphCanvas.node_colors.brown.color;
|
||||||
node.bgcolor = LGraphCanvas.node_colors.brown.bgcolor;
|
node.bgcolor = LGraphCanvas.node_colors.brown.bgcolor;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
import { app } from "../../../scripts/app.js";
|
|
||||||
//WIP doesn't do anything
|
|
||||||
app.registerExtension({
|
|
||||||
name: "KJNodes.PlotNode",
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
|
||||||
switch (nodeData.name) {
|
|
||||||
case "PlotNode":
|
|
||||||
|
|
||||||
nodeType.prototype.onNodeCreated = function () {
|
|
||||||
|
|
||||||
this.addWidget("button", "Update", null, () => {
|
|
||||||
|
|
||||||
console.log("start x:" + this.pos[0])
|
|
||||||
console.log("start y:" +this.pos[1])
|
|
||||||
console.log(this.graph.links);
|
|
||||||
const toNode = this.graph._nodes.find((otherNode) => otherNode.id == this.graph.links[1].target_id);
|
|
||||||
console.log("target x:" + toNode.pos[0])
|
|
||||||
const a = this.pos[0]
|
|
||||||
const b = toNode.pos[0]
|
|
||||||
const distance = Math.abs(a - b);
|
|
||||||
const maxDistance = 1000
|
|
||||||
const finalDistance = (distance - 0) / (maxDistance - 0);
|
|
||||||
|
|
||||||
this.widgets[0].value = finalDistance;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Loading…
x
Reference in New Issue
Block a user