Merge pull request #404 from maxsnew/empty

Add empty element
This commit is contained in:
Evan Czaplicki 2013-12-24 10:11:26 -08:00
commit 6db931849d

View file

@ -13,7 +13,7 @@ combine and position.
@docs widthOf, heightOf, sizeOf
# Layout
@docs flow, up, down, left, right, inward, outward
@docs flow, up, down, left, right, inward, outward, empty
## Layout Aliases
There are also some convenience functions for working
@ -58,6 +58,10 @@ type Properties = {
type Element = { props : Properties, element : ElementPrim }
{-| An Element that takes up no space -}
empty : Element
empty = spacer 0 0
{-| Get the width of an Element -}
widthOf : Element -> Int
widthOf e = e.props.width
@ -195,7 +199,7 @@ flow dir es =
hs = List.map heightOf es
newFlow w h = newElement w h (Flow dir es)
in
if es == [] then spacer 0 0 else
if es == [] then empty else
case dir of
DUp -> newFlow (List.maximum ws) (List.sum hs)
DDown -> newFlow (List.maximum ws) (List.sum hs)
@ -302,4 +306,4 @@ inward : Direction
inward = DIn
outward : Direction
outward = DOut
outward = DOut