« 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: fd43f8ef03f07f5140a2f4feaeb01a9c786e7217 (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 (let child of this.children) {
      child.x = nextX
      nextX = child.right + 1
    }
  }
}