~alcinnz/CatTrap

bc72114a4ef5c7a051abe805cf5668c8674fdbc5 — Adrian Cochrane 1 year, 1 month ago 5a9105c
Adjust flexbox terminology
2 files changed, 16 insertions(+), 16 deletions(-)

M Graphics/Layout/Flex.hs
M Graphics/Layout/Flex/CSS.hs
M Graphics/Layout/Flex.hs => Graphics/Layout/Flex.hs +3 -3
@@ 25,7 25,7 @@ data FlexChild a b = FlexChild {

data Direction = Row | Column
data FlexWrapping = NoWrap | Wrap | WrapReverse
data Justification = JLeft | JRight | JCenter | JSpaceBetween | JSpaceAround | JSpaceEvenly
data Justification = JStart | JEnd | JCenter | JSpaceBetween | JSpaceAround | JSpaceEvenly
data Alignment = AlStretch | AlStart | AlEnd | AlCenter | AlBaseline

flexMaxBasis :: FlexParent a Length -> Double -> Double


@@ 83,8 83,8 @@ flexWrap self size
        gfr = (size - rowSize)/(Prelude.sum $ map grow row)

justifyOffset, justifySpacing :: Double -> [Double] -> Double -> Justification -> Double
justifyOffset _ _ _ JLeft = 0
justifyOffset outersize ks g JRight = outersize - innersize g ks
justifyOffset _ _ _ JStart = 0
justifyOffset outersize ks g JEnd = outersize - innersize g ks
justifyOffset outersize ks g JCenter = half $ outersize - innersize g ks
justifyOffset _ _ _ JSpaceBetween = 0
justifyOffset outersize ks g JSpaceAround =

M Graphics/Layout/Flex/CSS.hs => Graphics/Layout/Flex/CSS.hs +13 -13
@@ 29,16 29,16 @@ data CSSFlex = CSSFlex {

setDir self dir rev = Just self { directionCSS = dir, reverseRowsCSS = rev }

parseJustify self "flex-start" | reverseRowsCSS self = Just JRight
    | otherwise = Just JLeft
parseJustify self "flex-end" | reverseRowsCSS self = Just JLeft
    | otherwise = Just JRight
parseJustify self "start" | textRTL self = Just JRight
    | otherwise = Just JLeft
parseJustify self "end" | textRTL self = Just JLeft
    | otherwise = Just JRight
parseJustify _ "left" = Just JLeft
parseJustify _ "right" = Just JRight
parseJustify self "flex-start" | reverseRowsCSS self = Just JEnd
    | otherwise = Just JStart
parseJustify self "flex-end" | reverseRowsCSS self = Just JStart
    | otherwise = Just JEnd
parseJustify self "start" | textRTL self = Just JEnd
    | otherwise = Just JStart
parseJustify self "end" | textRTL self = Just JStart
    | otherwise = Just JEnd
parseJustify _ "left" = Just JStart
parseJustify _ "right" = Just JEnd
parseJustify _ "center" = Just JCenter
parseJustify _ "space-between" = Just JSpaceBetween
parseJustify _ "space-around" = Just JSpaceAround


@@ 67,7 67,7 @@ instance PropertyParser CSSFlex where
        wrapCSS = NoWrap,
        justifyCSS = Nothing, -- flex-start, conditional on directionCSS
        alignItemsCSS = AlStretch,
        alignLinesCSS = Just JLeft,
        alignLinesCSS = Just JStart,
        rowGapCSS = (0,"px"),
        columnGapCSS = (0,"px"),
        orderCSS = 0,


@@ 174,8 174,8 @@ lowerFlex self font kids kids' fonts' = FlexParent {
    wrap = wrapCSS self,
    justify = case justifyCSS self of
        Just x -> x
        Nothing | reverseRowsCSS self -> JRight
        Nothing -> JLeft,
        Nothing | reverseRowsCSS self -> JEnd
        Nothing -> JStart,
    alignLines = alignLinesCSS self,
    baseGap = case directionCSS self of
        Row -> flip finalizeLength font $ rowGapCSS self