fixes in subgraph

This commit is contained in:
tamat
2020-07-20 15:32:39 +02:00
parent 55ad1b281e
commit f9d006c0df
5 changed files with 656 additions and 638 deletions

View File

@@ -142,7 +142,10 @@
var over = LiteGraph.isInsideRectangle(pos[0],pos[1],this.pos[0],this.pos[1] + y,this.size[0],LiteGraph.NODE_TITLE_HEIGHT);
ctx.fillStyle = over ? "#555" : "#222";
ctx.beginPath();
ctx.roundRect( 0, y, this.size[0]+1, LiteGraph.NODE_TITLE_HEIGHT, 0, 8);
if (this._shape == LiteGraph.BOX_SHAPE)
ctx.rect(0, y, this.size[0]+1, LiteGraph.NODE_TITLE_HEIGHT);
else
ctx.roundRect( 0, y, this.size[0]+1, LiteGraph.NODE_TITLE_HEIGHT, 0, 8);
ctx.fill();
//button
@@ -424,15 +427,21 @@
this.updateType();
}
//ensures the type in the node output and the type in the associated graph input are the same
GraphInput.prototype.updateType = function()
{
var type = this.properties.type;
this.type_widget.value = type;
//update output
if(this.outputs[0].type != type)
{
if (!LiteGraph.isValidConnection(this.outputs[0].type,type))
this.disconnectOutput(0);
this.outputs[0].type = type;
this.disconnectOutput(0);
}
//update widget
if(type == "number")
{
this.value_widget.type = "number";
@@ -454,8 +463,14 @@
this.value_widget.value = null;
}
this.properties.value = this.value_widget.value;
//update graph
if (this.graph && this.name_in_graph) {
this.graph.changeInputType(this.name_in_graph, type);
}
}
//this is executed AFTER the property has changed
GraphInput.prototype.onPropertyChanged = function(name,v)
{
if( name == "name" )
@@ -477,8 +492,7 @@
}
else if( name == "type" )
{
v = v || "";
this.updateType(v);
this.updateType();
}
else if( name == "value" )
{
@@ -555,6 +569,8 @@
if (v == "action" || v == "event") {
v = LiteGraph.ACTION;
}
if (!LiteGraph.isValidConnection(that.inputs[0].type,v))
that.disconnectInput(0);
that.inputs[0].type = v;
if (that.name_in_graph) {
//already added