add arrows to collapsed node

This commit is contained in:
inventivetalent
2018-10-19 17:31:48 +02:00
parent 1a9ee9fb0f
commit 1bda53ec29

View File

@@ -5347,10 +5347,16 @@ LGraphCanvas.prototype.drawNode = function(node, ctx )
continue;
ctx.fillStyle = slot.colorOn || this.default_connection_color.input_on;
ctx.beginPath();
if ( slot.type === LiteGraph.EVENT || slot.shape === LiteGraph.BOX_SHAPE)
if ( slot.type === LiteGraph.EVENT || slot.shape === LiteGraph.BOX_SHAPE) {
ctx.rect(0.5, 4 - LiteGraph.NODE_TITLE_HEIGHT + 0.5,14,LiteGraph.NODE_TITLE_HEIGHT - 8);
else
ctx.arc( 0, LiteGraph.NODE_TITLE_HEIGHT * -0.5, 4, 0, Math.PI*2 );
} else if (slot.shape === LiteGraph.ARROW_SHAPE) {
ctx.moveTo(8, LiteGraph.NODE_TITLE_HEIGHT * -0.5);
ctx.lineTo(-4, LiteGraph.NODE_TITLE_HEIGHT * -0.8);
ctx.lineTo(-4, LiteGraph.NODE_TITLE_HEIGHT * -0.2);
ctx.closePath();
} else {
ctx.arc(0, LiteGraph.NODE_TITLE_HEIGHT * -0.5, 4, 0, Math.PI * 2);
}
ctx.fill();
break;
}
@@ -5366,10 +5372,16 @@ LGraphCanvas.prototype.drawNode = function(node, ctx )
ctx.fillStyle = slot.colorOn || this.default_connection_color.output_on;
ctx.strokeStyle = "black";
ctx.beginPath();
if (slot.type === LiteGraph.EVENT || slot.shape === LiteGraph.BOX_SHAPE)
if (slot.type === LiteGraph.EVENT || slot.shape === LiteGraph.BOX_SHAPE) {
ctx.rect( node._collapsed_width - 4 + 0.5, 4 - LiteGraph.NODE_TITLE_HEIGHT + 0.5,14,LiteGraph.NODE_TITLE_HEIGHT - 8);
else
ctx.arc( node._collapsed_width, LiteGraph.NODE_TITLE_HEIGHT * -0.5, 4, 0, Math.PI*2 );
} else if (slot.shape === LiteGraph.ARROW_SHAPE) {
ctx.moveTo(8, LiteGraph.NODE_TITLE_HEIGHT * -0.5);
ctx.lineTo(-4, LiteGraph.NODE_TITLE_HEIGHT * -0.8);
ctx.lineTo(-4, LiteGraph.NODE_TITLE_HEIGHT * -0.2);
ctx.closePath();
} else {
ctx.arc(node._collapsed_width, LiteGraph.NODE_TITLE_HEIGHT * -0.5, 4, 0, Math.PI * 2);
}
ctx.fill();
ctx.stroke();
}