@@ -9,10 +9,10 @@ module Graphics.Element (widthOf, heightOf, sizeOf,
9 midLeft, midRight, midTop, midBottom, middleAt,
9 midLeft, midRight, midTop, midBottom, middleAt,
10 topLeftAt, topRightAt, bottomLeftAt, bottomRightAt,
10 topLeftAt, topRightAt, bottomLeftAt, bottomRightAt,
11 midLeftAt, midRightAt, midTopAt, midBottomAt,
11 midLeftAt, midRightAt, midTopAt, midBottomAt,
12− spacer
12+ spacer, newElement
15−import Native.Utils (guid)
15+import Native.Utils (guid, max)
16import JavaScript as JS
16import JavaScript as JS
17import List as List
17import List as List
18import Graphics.Color as Color
18import Graphics.Color as Color
@@ -73,8 +73,8 @@ spacer w h = newElement w h Spacer
73data Direction = DUp | DDown | DLeft | DRight | DIn | DOut
73data Direction = DUp | DDown | DLeft | DRight | DIn | DOut
75flow dir es =
75flow dir es =
76− let ws = map widthOf es
76+ let ws = List.map widthOf es
77− hs = map heightOf es
77+ hs = List.map heightOf es
78 newFlow w h = newElement w h (Flow dir es)
78 newFlow w h = newElement w h (Flow dir es)
80 case dir of
80 case dir of
@@ -85,13 +85,13 @@ flow dir es =
85 DIn -> newFlow (List.maximum ws) (List.maximum hs)
85 DIn -> newFlow (List.maximum ws) (List.maximum hs)
86 DOut -> newFlow (List.maximum ws) (List.maximum hs)
86 DOut -> newFlow (List.maximum ws) (List.maximum hs)
88−above hi lo = newElement (max (widthOf hi) (widthOf lo)) (heightOf hi + heightOf lo) (Flow DDown [hi,lo])
88+above hi lo = newElement (Utils.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])
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) (max (heightOf lft) (heightOf rht)) (Flow right [lft,rht])
90+beside lft rht = newElement (widthOf lft + widthOf rht) (Utils.max (heightOf lft) (heightOf rht)) (Flow right [lft,rht])
92layers es =
92layers es =
93− let ws = map widthOf es
93+ let ws = List.map widthOf es
94− hs = map heightOf es
94+ hs = List.map heightOf es
95 in newElement (List.maximum w) (List.maximum h) (Flow DOut es)
95 in newElement (List.maximum w) (List.maximum h) (Flow DOut es)