From 1d641bd565883ba59e2fdfd28fe76d8dd3a4a377 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 29 Oct 2021 11:03:57 +0200 Subject: [PATCH] Clarified FlexRow and FlexColumn. Also introduced CSS variants. Fixes #658 --- flex.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flex.go b/flex.go index b4fb2da..25dc99d 100644 --- a/flex.go +++ b/flex.go @@ -6,8 +6,10 @@ import ( // Configuration values. const ( - FlexRow = iota - FlexColumn + FlexRow = 0 // One item per row. + 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. @@ -58,7 +60,9 @@ func NewFlex() *Flex { } // 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 { f.direction = direction return f