summaryrefslogtreecommitdiff
path: root/tui/geometry.go
blob: b20960b6f124cd0c9cb0efa69a8adec22c959805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package tui

type Direction int
const (
	Down = iota
	Up
	Right
	Left
)

func (d Direction) axis() int {
	switch d {
	case Down, Up:
		return 1
	default:
		return 0
	}
}

func (d Direction) reverse() bool {
	switch d {
	case Down, Right:
		return false
	default:
		return true
	}
}

type rect struct {
	min [2]int
	max [2]int
}