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 fc6346e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/grapher.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,17 +714,20 @@ 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.width = this.width - xPadding - xPadding;
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 fc6346e

Please sign in to comment.