mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 23:34:31 +00:00
added combo widget
This commit is contained in:
@@ -273,6 +273,47 @@
|
||||
|
||||
LiteGraph.registerNodeType("widget/number", WidgetNumber);
|
||||
|
||||
|
||||
/* Combo ****************/
|
||||
|
||||
function WidgetCombo() {
|
||||
this.addOutput("", "string");
|
||||
this.addOutput("change", LiteGraph.EVENT);
|
||||
this.size = [80, 60];
|
||||
this.properties = { value: "A", values:"A;B;C" };
|
||||
this.old_y = -1;
|
||||
this.mouse_captured = false;
|
||||
this._values = this.properties.values.split(";");
|
||||
var that = this;
|
||||
this.widgets_up = true;
|
||||
this.widget = this.addWidget("combo","", this.properties.value, function(v){
|
||||
that.properties.value = v;
|
||||
that.triggerSlot(1, v);
|
||||
}, { property: "value", values: this._values } );
|
||||
}
|
||||
|
||||
WidgetCombo.title = "Combo";
|
||||
WidgetCombo.desc = "Widget to select from a list";
|
||||
|
||||
WidgetCombo.prototype.onExecute = function() {
|
||||
this.setOutputData( 0, this.properties.value );
|
||||
};
|
||||
|
||||
WidgetCombo.prototype.onPropertyChanged = function(name, value) {
|
||||
if(name == "values")
|
||||
{
|
||||
this._values = value.split(";");
|
||||
this.widget.options.values = this._values;
|
||||
}
|
||||
else if(name == "value")
|
||||
{
|
||||
this.widget.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
LiteGraph.registerNodeType("widget/combo", WidgetCombo);
|
||||
|
||||
|
||||
/* Knob ****************/
|
||||
|
||||
function WidgetKnob() {
|
||||
|
||||
Reference in New Issue
Block a user