From 16da7fb310198851c2e4b02abedfb24979287242 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 7 Jan 2017 18:26:02 -0400 Subject: Initial commit --- ui/HorizontalBox.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ui/HorizontalBox.js (limited to 'ui/HorizontalBox.js') diff --git a/ui/HorizontalBox.js b/ui/HorizontalBox.js new file mode 100644 index 0000000..fd43f8e --- /dev/null +++ b/ui/HorizontalBox.js @@ -0,0 +1,13 @@ +const DisplayElement = require('./DisplayElement') + +module.exports = class HorizontalBox extends DisplayElement { + // A box that will automatically lay out its children in a horizontal row. + + fixLayout() { + let nextX = 0 + for (let child of this.children) { + child.x = nextX + nextX = child.right + 1 + } + } +} -- cgit 1.3.0-6-gf8a5