Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Includes 30 custom nodes committed directly, 7 Civitai-exclusive loras stored via Git LFS, and a setup script that installs all dependencies and downloads HuggingFace-hosted models on vast.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
1.9 KiB
JavaScript
66 lines
1.9 KiB
JavaScript
import { app } from "../../../scripts/app.js";
|
|
|
|
|
|
app.registerExtension({
|
|
name: "comfy.easyUse.imageWidgets",
|
|
|
|
nodeCreated(node) {
|
|
if (["easy imageSize","easy imageSizeBySide","easy imageSizeByLongerSide","easy imageSizeShow", "easy imageRatio", "easy imagePixelPerfect"].includes(node.comfyClass)) {
|
|
|
|
const inputEl = document.createElement("textarea");
|
|
inputEl.className = "comfy-multiline-input";
|
|
inputEl.readOnly = true
|
|
|
|
const widget = node.addDOMWidget("info", "customtext", inputEl, {
|
|
getValue() {
|
|
return inputEl.value;
|
|
},
|
|
setValue(v) {
|
|
inputEl.value = v;
|
|
},
|
|
serialize: false
|
|
});
|
|
widget.inputEl = inputEl;
|
|
|
|
inputEl.addEventListener("input", () => {
|
|
widget.callback?.(widget.value);
|
|
});
|
|
}
|
|
},
|
|
|
|
beforeRegisterNodeDef(nodeType, nodeData, app) {
|
|
if (["easy imageSize","easy imageSizeBySide","easy imageSizeByLongerSide", "easy imageSizeShow", "easy imageRatio", "easy imagePixelPerfect"].includes(nodeData.name)) {
|
|
function populate(arr_text) {
|
|
var text = '';
|
|
for (let i = 0; i < arr_text.length; i++){
|
|
text += arr_text[i];
|
|
}
|
|
if (this.widgets) {
|
|
const pos = this.widgets.findIndex((w) => w.name === "info");
|
|
if (pos !== -1 && this.widgets[pos]) {
|
|
const w = this.widgets[pos]
|
|
w.value = text;
|
|
}
|
|
}
|
|
requestAnimationFrame(() => {
|
|
const sz = this.computeSize();
|
|
if (sz[0] < this.size[0]) {
|
|
sz[0] = this.size[0];
|
|
}
|
|
if (sz[1] < this.size[1]) {
|
|
sz[1] = this.size[1];
|
|
}
|
|
this.onResize?.(sz);
|
|
app.graph.setDirtyCanvas(true, false);
|
|
});
|
|
}
|
|
|
|
// When the node is executed we will be sent the input text, display this in the widget
|
|
const onExecuted = nodeType.prototype.onExecuted;
|
|
nodeType.prototype.onExecuted = function (message) {
|
|
onExecuted?.apply(this, arguments);
|
|
populate.call(this, message.text);
|
|
};
|
|
}
|
|
}
|
|
}) |