mirror of https://github.com/rivo/tview.git
Clarified FlexRow and FlexColumn. Also introduced CSS variants. Fixes #658
This commit is contained in:
parent
792841ab16
commit
1d641bd565
10
flex.go
10
flex.go
|
@ -6,8 +6,10 @@ import (
|
||||||
|
|
||||||
// Configuration values.
|
// Configuration values.
|
||||||
const (
|
const (
|
||||||
FlexRow = iota
|
FlexRow = 0 // One item per row.
|
||||||
FlexColumn
|
FlexColumn = 1 // One item per column.
|
||||||
|
FlexRowCSS = 1 // As defined in CSS, items distributed along a row.
|
||||||
|
FlexColumnCSS = 0 // As defined in CSS, items distributed within a column.
|
||||||
)
|
)
|
||||||
|
|
||||||
// flexItem holds layout options for one item.
|
// flexItem holds layout options for one item.
|
||||||
|
@ -58,7 +60,9 @@ func NewFlex() *Flex {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDirection sets the direction in which the contained primitives are
|
// SetDirection sets the direction in which the contained primitives are
|
||||||
// distributed. This can be either FlexColumn (default) or FlexRow.
|
// distributed. This can be either FlexColumn (default) or FlexRow. Note that
|
||||||
|
// these are the opposite of what you would expect coming from CSS. You may also
|
||||||
|
// use FlexColumnCSS or FlexRowCSS, to remain in line with the CSS definition.
|
||||||
func (f *Flex) SetDirection(direction int) *Flex {
|
func (f *Flex) SetDirection(direction int) *Flex {
|
||||||
f.direction = direction
|
f.direction = direction
|
||||||
return f
|
return f
|
||||||
|
|
Loading…
Reference in New Issue