This commit is contained in:
tamat
2019-01-05 23:57:24 +01:00
5 changed files with 481 additions and 438 deletions

View File

@@ -5857,7 +5857,11 @@ LGraphCanvas.prototype.drawNodeShape = function( node, ctx, size, fgcolor, bgcol
if(render_title || title_mode == LiteGraph.TRANSPARENT_TITLE )
{
//title bar
if(title_mode != LiteGraph.TRANSPARENT_TITLE) //!node.flags.collapsed)
if(node.onDrawTitleBar)
{
node.onDrawTitleBar(ctx, title_height, size, this.scale, fgcolor);
}
else if(title_mode != LiteGraph.TRANSPARENT_TITLE) //!node.flags.collapsed)
{
if(node.flags.collapsed)
ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR;
@@ -5889,37 +5893,42 @@ LGraphCanvas.prototype.drawNodeShape = function( node, ctx, size, fgcolor, bgcol
}
//title box
if(node.flags.render_box !== false)
if(node.onDrawTitleBox)
{
if (shape == LiteGraph.ROUND_SHAPE || shape == LiteGraph.CIRCLE_SHAPE || shape == LiteGraph.CARD_SHAPE)
node.onDrawTitleBox( ctx, title_height, size, this.scale );
}
else if ( shape == LiteGraph.ROUND_SHAPE || shape == LiteGraph.CIRCLE_SHAPE || shape == LiteGraph.CARD_SHAPE )
{
if( this.scale > 0.5 )
{
if( this.scale > 0.5 )
{
ctx.fillStyle = "black";
ctx.beginPath();
ctx.arc(title_height *0.5, title_height * -0.5, (title_height - 8) *0.5,0,Math.PI*2);
ctx.fill();
}
ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR;
ctx.fillStyle = "black";
ctx.beginPath();
ctx.arc(title_height *0.5, title_height * -0.5, (title_height - 8) *0.4,0,Math.PI*2);
ctx.arc(title_height *0.5, title_height * -0.5, (title_height - 8) *0.5,0,Math.PI*2);
ctx.fill();
}
else
ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR;
ctx.beginPath();
ctx.arc(title_height *0.5, title_height * -0.5, (title_height - 8) *0.4,0,Math.PI*2);
ctx.fill();
}
else
{
if( this.scale > 0.5 )
{
if( this.scale > 0.5 )
{
ctx.fillStyle = "black";
ctx.fillRect(4,-title_height + 4,title_height - 8,title_height - 8);
}
ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR;
ctx.fillRect(5,-title_height + 5,title_height - 10,title_height - 10);
ctx.fillStyle = "black";
ctx.fillRect(4,-title_height + 4,title_height - 8,title_height - 8);
}
ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR;
ctx.fillRect(5,-title_height + 5,title_height - 10,title_height - 10);
}
ctx.globalAlpha = old_alpha;
//title text
if(node.onDrawTitleText)
{
node.onDrawTitleText(ctx, title_height, size, this.scale, this.title_text_font, selected);
}
if( this.scale > 0.5 )
{
ctx.font = this.title_text_font;