little fixes

This commit is contained in:
tamat
2018-10-27 15:22:56 +02:00
parent 122450747d
commit 97dd9a95da
2 changed files with 49 additions and 20 deletions

View File

@@ -40,14 +40,39 @@ function Subgraph()
this.subgraph.onGlobalOutputRenamed = this.onSubgraphRenamedGlobalOutput.bind(this);
this.subgraph.onGlobalOutputTypeChanged = this.onSubgraphTypeChangeGlobalOutput.bind(this);
this.addWidget("button","Open Graph",null,function( widget, graphcanvas ){ graphcanvas.openSubgraph(that.subgraph) });
this.bgcolor = "#353";
this.color = "#335";
this.bgcolor = "#557";
}
Subgraph.title = "Subgraph";
Subgraph.desc = "Graph inside a node";
Subgraph.prototype.onDrawTitle = function(ctx)
{
if(this.flags.collapsed)
return;
ctx.fillStyle = "#AAA";
var w = LiteGraph.NODE_TITLE_HEIGHT;
var x = this.size[0] - w;
ctx.fillRect( x, -w, w,w );
ctx.fillStyle = "#333";
ctx.beginPath();
ctx.moveTo( x+w*0.2, -w*0.6 );
ctx.lineTo( x+w*0.8, -w*0.6 );
ctx.lineTo( x+w*0.5, -w*0.3 );
ctx.fill();
}
Subgraph.prototype.onMouseDown = function(e,pos,graphcanvas)
{
if( !this.flags.collapsed && pos[0] > this.size[0] - LiteGraph.NODE_TITLE_HEIGHT && pos[1] < 0 )
{
var that = this;
setTimeout(function(){ graphcanvas.openSubgraph( that.subgraph ); },10 );
}
}
Subgraph.prototype.onSubgraphNewGlobalInput = function(name, type)
{
//add input to the node
@@ -109,16 +134,6 @@ Subgraph.prototype.getExtraMenuOptions = function(graphcanvas)
}];
}
Subgraph.prototype.onDrawForeground = function( ctx, graphcanvas )
{
/*
var node = this;
ctx.globalAlpha = 0.75;
graphcanvas.guiButton( ctx, [0,this.size[1] - 20, this.size[0], 19 ], "Open", function(){ graphcanvas.openSubgraph(node.subgraph); });
ctx.globalAlpha = 1;
*/
}
Subgraph.prototype.onResize = function(size)
{
size[1] += 20;