@@ -9,10 +9,10 @@ module Graphics.Element (widthOf, heightOf, sizeOf,
99 midLeft, midRight, midTop, midBottom, middleAt,
1010 topLeftAt, topRightAt, bottomLeftAt, bottomRightAt,
1111 midLeftAt, midRightAt, midTopAt, midBottomAt,
12− spacer
12+ spacer, newElement
1313 ) where
1414
15−import Native.Utils (guid)
15+import Native.Utils (guid, max)
1616import JavaScript as JS
1717import List as List
1818import Graphics.Color as Color
@@ -73,8 +73,8 @@ spacer w h = newElement w h Spacer
7373data Direction = DUp | DDown | DLeft | DRight | DIn | DOut
7474
7575flow dir es =
76− let ws = map widthOf es
77− hs = map heightOf es
76+ let ws = List.map widthOf es
77+ hs = List.map heightOf es
7878 newFlow w h = newElement w h (Flow dir es)
7979 in
8080 case dir of
@@ -85,13 +85,13 @@ flow dir es =
8585 DIn -> newFlow (List.maximum ws) (List.maximum hs)
8686 DOut -> newFlow (List.maximum ws) (List.maximum hs)
8787
88−above hi lo = newElement (max (widthOf hi) (widthOf lo)) (heightOf hi + heightOf lo) (Flow DDown [hi,lo])
89−below lo hi = newElement (max (widthOf hi) (widthOf lo)) (heightOf hi + heightOf lo) (Flow DDown [hi,lo])
90−beside lft rht = newElement (widthOf lft + widthOf rht) (max (heightOf lft) (heightOf rht)) (Flow right [lft,rht])
88+above hi lo = newElement (Utils.max (widthOf hi) (widthOf lo)) (heightOf hi + heightOf lo) (Flow DDown [hi,lo])
89+below lo hi = newElement (Utils.max (widthOf hi) (widthOf lo)) (heightOf hi + heightOf lo) (Flow DDown [hi,lo])
90+beside lft rht = newElement (widthOf lft + widthOf rht) (Utils.max (heightOf lft) (heightOf rht)) (Flow right [lft,rht])
9191
9292layers es =
93− let ws = map widthOf es
94− hs = map heightOf es
93+ let ws = List.map widthOf es
94+ hs = List.map heightOf es
9595 in newElement (List.maximum w) (List.maximum h) (Flow DOut es)
9696
9797