Skip to content

Commit 7297f9a

Browse files
committed
Center buildings within their respective lanes
1 parent 2bd3b97 commit 7297f9a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js/techtree.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ class Lane {
9191
lane_width = Math.max(lane_width, row_width);
9292
}
9393
this.width = lane_width;
94+
95+
for (let r of Object.keys(this.rows)) {
96+
for (let i = 0; i < this.rows[r].length; i++) {
97+
if(this.rows[r][i].type == TYPES.BUILDING){
98+
this.rows[r][i].x = this.x + ((this.width - this.padding) / 2) - (this.rows[r][i].width / 2);
99+
}
100+
}
101+
}
94102
}
95103

96104
}

0 commit comments

Comments
 (0)