mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
Merge pull request #24 from merwaaan/master
Fix HSlider widget not initializing correctly
This commit is contained in:
@@ -210,7 +210,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
{
|
{
|
||||||
//this.oldmouse = null;
|
//this.oldmouse = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetKnob.prototype.onWidget = function(e,widget)
|
WidgetKnob.prototype.onWidget = function(e,widget)
|
||||||
{
|
{
|
||||||
if(widget.name=="increase")
|
if(widget.name=="increase")
|
||||||
@@ -252,7 +252,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
WidgetHSlider.title = "H.Slider";
|
WidgetHSlider.title = "H.Slider";
|
||||||
WidgetHSlider.desc = "Linear slider controller";
|
WidgetHSlider.desc = "Linear slider controller";
|
||||||
|
|
||||||
WidgetHSlider.prototype.onInit = function()
|
WidgetHSlider.prototype.onAdded = function()
|
||||||
{
|
{
|
||||||
this.value = 0.5;
|
this.value = 0.5;
|
||||||
this.imgfg = this.loadImage("imgs/slider_fg.png");
|
this.imgfg = this.loadImage("imgs/slider_fg.png");
|
||||||
@@ -278,7 +278,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
|
|
||||||
WidgetHSlider.prototype.onDrawImage = function(ctx)
|
WidgetHSlider.prototype.onDrawImage = function(ctx)
|
||||||
{
|
{
|
||||||
if(!this.imgfg || !this.imgfg.width)
|
if(!this.imgfg || !this.imgfg.width)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//border
|
//border
|
||||||
@@ -405,8 +405,8 @@ var LiteGraph = global.LiteGraph;
|
|||||||
|
|
||||||
createGradient: function(ctx)
|
createGradient: function(ctx)
|
||||||
{
|
{
|
||||||
this.lineargradient = ctx.createLinearGradient(0,0,0,this.size[1]);
|
this.lineargradient = ctx.createLinearGradient(0,0,0,this.size[1]);
|
||||||
this.lineargradient.addColorStop(0,this.properties["bgcolorTop"]);
|
this.lineargradient.addColorStop(0,this.properties["bgcolorTop"]);
|
||||||
this.lineargradient.addColorStop(1,this.properties["bgcolorBottom"]);
|
this.lineargradient.addColorStop(1,this.properties["bgcolorBottom"]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
if(!this.oldmouse) return;
|
if(!this.oldmouse) return;
|
||||||
|
|
||||||
var m = [ e.canvasX - this.pos[0], e.canvasY - this.pos[1] ];
|
var m = [ e.canvasX - this.pos[0], e.canvasY - this.pos[1] ];
|
||||||
|
|
||||||
this.properties.x = m[0] / this.size[0];
|
this.properties.x = m[0] / this.size[0];
|
||||||
this.properties.y = m[1] / this.size[1];
|
this.properties.y = m[1] / this.size[1];
|
||||||
|
|
||||||
@@ -505,8 +505,8 @@ var LiteGraph = global.LiteGraph;
|
|||||||
|
|
||||||
createGradient: function(ctx)
|
createGradient: function(ctx)
|
||||||
{
|
{
|
||||||
this.lineargradient = ctx.createLinearGradient(0,0,0,this.size[1]);
|
this.lineargradient = ctx.createLinearGradient(0,0,0,this.size[1]);
|
||||||
this.lineargradient.addColorStop(0,this.properties["bgcolorTop"]);
|
this.lineargradient.addColorStop(0,this.properties["bgcolorTop"]);
|
||||||
this.lineargradient.addColorStop(1,this.properties["bgcolorBottom"]);
|
this.lineargradient.addColorStop(1,this.properties["bgcolorBottom"]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
{
|
{
|
||||||
ctx.fillStyle = this.mouseOver ? this.properties["color"] : "#AAA";
|
ctx.fillStyle = this.mouseOver ? this.properties["color"] : "#AAA";
|
||||||
|
|
||||||
if(this.clicking)
|
if(this.clicking)
|
||||||
ctx.fillStyle = "#FFF";
|
ctx.fillStyle = "#FFF";
|
||||||
|
|
||||||
ctx.strokeStyle = "#AAA";
|
ctx.strokeStyle = "#AAA";
|
||||||
@@ -544,7 +544,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
this.createGradient(ctx);
|
this.createGradient(ctx);
|
||||||
|
|
||||||
ctx.fillStyle = this.mouseOver ? this.properties["color"] : this.lineargradient;
|
ctx.fillStyle = this.mouseOver ? this.properties["color"] : this.lineargradient;
|
||||||
if(this.clicking)
|
if(this.clicking)
|
||||||
ctx.fillStyle = "#444";
|
ctx.fillStyle = "#444";
|
||||||
|
|
||||||
ctx.strokeStyle = "#FFF";
|
ctx.strokeStyle = "#FFF";
|
||||||
@@ -575,7 +575,7 @@ var LiteGraph = global.LiteGraph;
|
|||||||
}
|
}
|
||||||
else if(module && module.onTrigger)
|
else if(module && module.onTrigger)
|
||||||
{
|
{
|
||||||
module.onTrigger();
|
module.onTrigger();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -732,8 +732,8 @@ var LiteGraph = global.LiteGraph;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lineargradient = ctx.createLinearGradient(0,0,0,this.size[1]);
|
this.lineargradient = ctx.createLinearGradient(0,0,0,this.size[1]);
|
||||||
this.lineargradient.addColorStop(0,this.properties["bgcolorTop"]);
|
this.lineargradient.addColorStop(0,this.properties["bgcolorTop"]);
|
||||||
this.lineargradient.addColorStop(1,this.properties["bgcolorBottom"]);
|
this.lineargradient.addColorStop(1,this.properties["bgcolorBottom"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user