diff options
Diffstat (limited to 'ui/presentation/HorizontalBox.js')
-rw-r--r-- | ui/presentation/HorizontalBox.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/presentation/HorizontalBox.js b/ui/presentation/HorizontalBox.js new file mode 100644 index 0000000..d396ec3 --- /dev/null +++ b/ui/presentation/HorizontalBox.js @@ -0,0 +1,13 @@ +import {DisplayElement} from 'tui-lib/ui/primitives' + +export default class HorizontalBox extends DisplayElement { + // A box that will automatically lay out its children in a horizontal row. + + fixLayout() { + let nextX = 0 + for (const child of this.children) { + child.x = nextX + nextX = child.right + 1 + } + } +} |