added searchbox

This commit is contained in:
tamat
2018-07-04 23:13:50 +02:00
parent f2a11fc9df
commit 9fbedb3e11
6 changed files with 788 additions and 285 deletions

View File

@@ -25,7 +25,7 @@ LiteGraph.registerNodeType("basic/time", Time);
function Subgraph()
{
var that = this;
this.size = [120,60];
this.size = [120,80];
//create inner graph
this.subgraph = new LGraph();
@@ -40,7 +40,7 @@ function Subgraph()
this.subgraph.onGlobalOutputRenamed = this.onSubgraphRenamedGlobalOutput.bind(this);
this.subgraph.onGlobalOutputTypeChanged = this.onSubgraphTypeChangeGlobalOutput.bind(this);
this.bgcolor = "#663";
this.bgcolor = "#353";
}
Subgraph.title = "Subgraph";
@@ -107,6 +107,19 @@ 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;
}
Subgraph.prototype.onExecute = function()
{
//send inputs to subgraph global inputs

View File

@@ -115,6 +115,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.graph._version++;
this.trigger( "e", this.properties.value );
return true;
}
@@ -202,6 +203,7 @@ var LiteGraph = global.LiteGraph;
var v = Math.clamp( this.properties.value + steps * this.properties.step, this.properties.min, this.properties.max );
this.properties.value = v;
this.graph._version++;
this.setDirtyCanvas(true);
}
@@ -211,6 +213,7 @@ var LiteGraph = global.LiteGraph;
{
var steps = pos[1] > this.size[1] * 0.5 ? -1 : 1;
this.properties.value = Math.clamp( this.properties.value + steps * this.properties.step, this.properties.min, this.properties.max );
this.graph._version++;
this.setDirtyCanvas(true);
}