« get me outta code hell

HorizontalBox.js « presentation « 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/presentation/HorizontalBox.js
blob: d396ec3a88f2ab7491305b7f61cdc1f76137fe59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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
    }
  }
}