Merge 2e9f97797ed55e6c78b8a163f86ab98d58141f7c into 04b308229ee59b5aebc0c78ea416e0b3ac22c146

This commit is contained in:
Daniel Lewis 2024-05-31 11:15:53 -07:00 committed by GitHub
commit 2a6e0ed3af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View File

@ -9943,6 +9943,7 @@ LGraphNode.prototype.executeAction = function(action)
break; break;
case "string": case "string":
case "text": case "text":
case "password":
ctx.textAlign = "left"; ctx.textAlign = "left";
ctx.strokeStyle = outline_color; ctx.strokeStyle = outline_color;
ctx.fillStyle = background_color; ctx.fillStyle = background_color;
@ -9968,7 +9969,11 @@ LGraphNode.prototype.executeAction = function(action)
} }
ctx.fillStyle = text_color; ctx.fillStyle = text_color;
ctx.textAlign = "right"; ctx.textAlign = "right";
ctx.fillText(String(w.value).substr(0,30), widget_width - margin * 2, y + H * 0.7); //30 chars max let value = w.value;
if(w.type == "password") {
value = value.replace(/./g, "*");
}
ctx.fillText(String(value).substr(0,30), widget_width - margin * 2, y + H * 0.7); //30 chars max
ctx.restore(); ctx.restore();
} }
break; break;
@ -10156,6 +10161,7 @@ LGraphNode.prototype.executeAction = function(action)
break; break;
case "string": case "string":
case "text": case "text":
case "password":
if (event.type == LiteGraph.pointerevents_method+"down") { if (event.type == LiteGraph.pointerevents_method+"down") {
this.prompt("Value",w.value,function(v) { this.prompt("Value",w.value,function(v) {
inner_value_change(this, v); inner_value_change(this, v);

View File

@ -359,6 +359,22 @@ export const ComfyWidgets = {
return res; return res;
}, },
PASSWORD(node, inputName, inputData, app) {
const defaultVal = inputData[1].default || "";
const multiline = !!inputData[1].multiline;
let res;
if (multiline) {
res = addMultilineWidget(node, inputName, { defaultVal, ...inputData[1] }, app);
} else {
res = { widget: node.addWidget("password", inputName, defaultVal, () => {}, {}) };
}
if(inputData[1].dynamicPrompts != undefined)
res.widget.dynamicPrompts = inputData[1].dynamicPrompts;
return res;
},
COMBO(node, inputName, inputData) { COMBO(node, inputName, inputData) {
const type = inputData[0]; const type = inputData[0];
let defaultValue = type[0]; let defaultValue = type[0];