mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 17:52:16 +00:00
little fixes in some nodes
This commit is contained in:
@@ -55,7 +55,7 @@ Editor.prototype.addLoadCounter = function()
|
||||
var self = this;
|
||||
|
||||
setInterval(function() {
|
||||
meter.querySelector(".cpuload .fgload").style.width = ((2*self.graph.elapsed_time) * 90) + "px";
|
||||
meter.querySelector(".cpuload .fgload").style.width = ((2*self.graph.execution_time) * 90) + "px";
|
||||
if(self.graph.status == LGraph.STATUS_RUNNING)
|
||||
meter.querySelector(".gpuload .fgload").style.width = ((self.graphcanvas.render_time*10) * 90) + "px";
|
||||
else
|
||||
|
||||
@@ -437,6 +437,7 @@ LGraph.prototype.clear = function()
|
||||
this.fixedtime = 0;
|
||||
this.fixedtime_lapse = 0.01;
|
||||
this.elapsed_time = 0.01;
|
||||
this.last_update_time = 0;
|
||||
this.starttime = 0;
|
||||
|
||||
this.catch_errors = true;
|
||||
@@ -509,6 +510,7 @@ LGraph.prototype.start = function(interval)
|
||||
|
||||
//launch
|
||||
this.starttime = LiteGraph.getTime();
|
||||
this.last_update_time = this.starttime;
|
||||
interval = interval || 1;
|
||||
var that = this;
|
||||
|
||||
@@ -611,12 +613,15 @@ LGraph.prototype.runStep = function( num, do_not_catch_errors )
|
||||
}
|
||||
}
|
||||
|
||||
var elapsed = LiteGraph.getTime() - start;
|
||||
var now = LiteGraph.getTime();
|
||||
var elapsed = now - start;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
this.elapsed_time = 0.001 * elapsed;
|
||||
this.execution_time = 0.001 * elapsed;
|
||||
this.globaltime += 0.001 * elapsed;
|
||||
this.iteration += 1;
|
||||
this.elapsed_time = (now - this.last_update_time) * 0.001;
|
||||
this.last_update_time = now;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -359,12 +359,7 @@ Watch.prototype.onDrawBackground = function(ctx)
|
||||
if (this.properties["value"].constructor === Number )
|
||||
this.inputs[0].label = this.properties["value"].toFixed(3);
|
||||
else
|
||||
{
|
||||
var str = this.properties["value"];
|
||||
if(str && str.length) //convert typed to array
|
||||
str = Array.prototype.slice.call(str).join(",");
|
||||
this.inputs[0].label = str;
|
||||
}
|
||||
this.inputs[0].label = String(this.properties.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ DelayEvent.prototype.onAction = function(action, param)
|
||||
DelayEvent.prototype.onExecute = function()
|
||||
{
|
||||
var dt = this.graph.elapsed_time * 1000; //in ms
|
||||
console.log(this._pending);
|
||||
|
||||
for(var i = 0; i < this._pending.length; ++i)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ var LiteGraph = global.LiteGraph;
|
||||
{
|
||||
this.addOutput( "clicked", LiteGraph.EVENT );
|
||||
this.addProperty( "text","" );
|
||||
this.addProperty( "font","40px Arial" );
|
||||
this.addProperty( "font_size", 40 );
|
||||
this.addProperty( "message", "" );
|
||||
this.size = [64,84];
|
||||
}
|
||||
@@ -16,6 +16,7 @@ var LiteGraph = global.LiteGraph;
|
||||
WidgetButton.title = "Button";
|
||||
WidgetButton.desc = "Triggers an event";
|
||||
|
||||
WidgetButton.font = "Arial";
|
||||
WidgetButton.prototype.onDrawForeground = function(ctx)
|
||||
{
|
||||
if(this.flags.collapsed)
|
||||
@@ -32,11 +33,11 @@ var LiteGraph = global.LiteGraph;
|
||||
|
||||
if( this.properties.text || this.properties.text === 0 )
|
||||
{
|
||||
var font_size = this.properties.font_size || 30;
|
||||
ctx.textAlign = "center";
|
||||
ctx.fillStyle = this.clicked ? "black" : "white";
|
||||
if( this.properties.font )
|
||||
ctx.font = this.properties.font;
|
||||
ctx.fillText(this.properties.text, this.size[0] * 0.5, this.size[1] * 0.85 );
|
||||
ctx.font = font_size + "px " + WidgetButton.font;
|
||||
ctx.fillText( this.properties.text, this.size[0] * 0.5, this.size[1] * 0.5 + font_size * 0.3 );
|
||||
ctx.textAlign = "left";
|
||||
}
|
||||
}
|
||||
@@ -107,7 +108,7 @@ var LiteGraph = global.LiteGraph;
|
||||
if(local_pos[0] > 1 && local_pos[1] > 1 && local_pos[0] < (this.size[0] - 2) && local_pos[1] < (this.size[1] - 2) )
|
||||
{
|
||||
this.properties.value = !this.properties.value;
|
||||
this.trigger( "clicked", this.properties.value );
|
||||
this.trigger( "e", this.properties.value );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user