fix cosmetics

This commit is contained in:
Tropfchen
2023-10-24 23:22:53 +02:00
parent 6887dd2237
commit 3bc2f4325f
+7 -1
View File
@@ -126,6 +126,7 @@ function placeNewNode(name, nextTo, options = {}) {
function prependNode(node, nodeData, newNode, newNodeWidgetNames) { function prependNode(node, nodeData, newNode, newNodeWidgetNames) {
for (const widget_name of newNodeWidgetNames) { for (const widget_name of newNodeWidgetNames) {
let slot = node.findInputSlot(widget_name); let slot = node.findInputSlot(widget_name);
if (slot === -1) { if (slot === -1) {
//Convert widget into input //Convert widget into input
const w = node.widgets.find((obj) => obj.name === widget_name); const w = node.widgets.find((obj) => obj.name === widget_name);
@@ -164,7 +165,11 @@ app.registerExtension({
newNode[prop] = this[prop]; newNode[prop] = this[prop];
} }
}); });
} catch (e) {
console.error("Failed to copy colors", e);
}
try {
// copy prompts to new node // copy prompts to new node
const prompts = this.widgets.find((w) => w.name === "text").value; const prompts = this.widgets.find((w) => w.name === "text").value;
if (prompts && typeof prompts !== "undefined") { if (prompts && typeof prompts !== "undefined") {
@@ -177,7 +182,8 @@ app.registerExtension({
prependNode(this, nodeData, newNode, ["text"]); prependNode(this, nodeData, newNode, ["text"]);
if (this.size[1] > 120) { if (this.size[1] > 120) {
// In some cases settings size too low breaks node. Minimum size of CLIPTextEncode is 210x50 and 210x118 for EP // In some cases setting size too low breaks nodes.
// Minimum size of CLIPTextEncode is 210x50 and 210x118 for EP
this.size = [this.size[0], 120]; this.size = [this.size[0], 120];
} }
}, },