Skip to content

Commit

Permalink
Update grapher.js (#1285)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jul 6, 2024
1 parent 263ee4d commit 742dcbd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/grapher.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,17 +714,19 @@ grapher.Argument = class {
layout() {
const yPadding = 1;
const xPadding = 6;
let y = this.y + this.bottom;
if (this.type === 'node') {
const node = this.content;
node.width = this.width - xPadding - xPadding;
node.layout();
node.x = this.x + xPadding + (node.width / 2);
node.y = this.y + this.bottom + (node.height / 2) + yPadding + yPadding;
node.y = y + (node.height / 2) + yPadding + yPadding;
} else if (this.type === 'node[]') {
for (const node of this.content) {
node.layout();
node.x = this.x + xPadding + (node.width / 2);
node.y = this.y + (node.height / 2) + yPadding + yPadding;
node.y = y + (node.height / 2) + yPadding + yPadding;
y += node.height + yPadding + yPadding + yPadding + yPadding;
}
}
}
Expand Down

0 comments on commit 742dcbd

Please sign in to comment.