Clarified FlexRow and FlexColumn. Also introduced CSS variants. Fixes #658

This commit is contained in:
Oliver 2021-10-29 11:03:57 +02:00
parent 792841ab16
commit 1d641bd565
1 changed files with 7 additions and 3 deletions

10
flex.go
View File

@ -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