mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 15:29:44 +00:00
fix in widgets
This commit is contained in:
@@ -110,6 +110,7 @@
|
||||
function MathRange() {
|
||||
this.addInput("in", "number", { locked: true });
|
||||
this.addOutput("out", "number", { locked: true });
|
||||
this.addOutput("clamped", "number", { locked: true });
|
||||
|
||||
this.addProperty("in", 0);
|
||||
this.addProperty("in_min", 0);
|
||||
@@ -117,7 +118,7 @@
|
||||
this.addProperty("out_min", 0);
|
||||
this.addProperty("out_max", 1);
|
||||
|
||||
this.size = [80, 30];
|
||||
this.size = [120, 50];
|
||||
}
|
||||
|
||||
MathRange.title = "Range";
|
||||
@@ -151,10 +152,22 @@
|
||||
var in_max = this.properties.in_max;
|
||||
var out_min = this.properties.out_min;
|
||||
var out_max = this.properties.out_max;
|
||||
/*
|
||||
if( in_min > in_max )
|
||||
{
|
||||
in_min = in_max;
|
||||
in_max = this.properties.in_min;
|
||||
}
|
||||
if( out_min > out_max )
|
||||
{
|
||||
out_min = out_max;
|
||||
out_max = this.properties.out_min;
|
||||
}
|
||||
*/
|
||||
|
||||
this._last_v =
|
||||
((v - in_min) / (in_max - in_min)) * (out_max - out_min) + out_min;
|
||||
this._last_v = ((v - in_min) / (in_max - in_min)) * (out_max - out_min) + out_min;
|
||||
this.setOutputData(0, this._last_v);
|
||||
this.setOutputData(1, Math.clamp( this._last_v, out_min, out_max ));
|
||||
};
|
||||
|
||||
MathRange.prototype.onDrawBackground = function(ctx) {
|
||||
|
||||
Reference in New Issue
Block a user