« get me outta code hell

HorizontalBox.js « ui - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/ui/HorizontalBox.js
blob: f92bf105bd91ca9f1a87bf80176f3f87ae58d7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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 (const child of this.children) {
      child.x = nextX
      nextX = child.right + 1
    }
  }
}