on master help sign in
Add empty element
commit6992d941c79bd91e7d6b567238e221aac084c111 authorMax New <maxsnew@gmail.com> dateFri 20 Dec 2013, 23:35 (13 years ago) parent39769b7
1 file changed+7−3
libraries/Graphics/Element.elm+7−3
libraries/Graphics/Element.elm+7−3
@@ -13,7 +13,7 @@ combine and position.
1313@docs widthOf, heightOf, sizeOf
1414
1515# Layout
16−@docs flow, up, down, left, right, inward, outward
16+@docs flow, up, down, left, right, inward, outward, empty
1717
1818## Layout Aliases
1919There are also some convenience functions for working
@@ -58,6 +58,10 @@ type Properties = {
5858
5959type Element = { props : Properties, element : ElementPrim }
6060
61+{-| An Element that takes up no space -}
62+empty : Element
63+empty = spacer 0 0
64+
6165{-| Get the width of an Element -}
6266widthOf : Element -> Int
6367widthOf e = e.props.width
@@ -195,7 +199,7 @@ flow dir es =
195199 hs = List.map heightOf es
196200 newFlow w h = newElement w h (Flow dir es)
197201 in
198− if es == [] then spacer 0 0 else
202+ if es == [] then empty else
199203 case dir of
200204 DUp -> newFlow (List.maximum ws) (List.sum hs)
201205 DDown -> newFlow (List.maximum ws) (List.sum hs)
@@ -302,4 +306,4 @@ inward : Direction
302306inward = DIn
303307
304308outward : Direction
305−outward = DOut
309+outward = DOut