@@ -91,6 +91,8 @@ regularScale = "scale3d(1.0, 1.0, 1.0)"
92scaledUp = "scale3d(1.1, 1.1, 1.1)"
92scaledUp = "scale3d(1.1, 1.1, 1.1)"
94+scaledCompletely = "scale3d(2.0, 2.0, 2.0)"
94defaultSprings =
96defaultSprings =
@@ -100,7 +102,7 @@ defaultSprings =
100 , transform: "scale3d(1.0,1.0,1.0)"
102 , transform: "scale3d(1.0,1.0,1.0)"
103−springsteen init rectsRef positionsRef arg mx my down springs = do
105+springsteen init windowSize rectsRef positionsRef arg mx my down tap springs = do
105 rects <- readRef rectsRef
107 rects <- readRef rectsRef
106 positionsBefore <- readRef positionsRef
108 positionsBefore <- readRef positionsRef
@@ -122,24 +124,25 @@ springsteen init rectsRef positionsRef arg mx my down springs = do
122 currentRect = rects !!! (positions !!! i)
124 currentRect = rects !!! (positions !!! i)
123 leftOffset = currentRect.left - originalRect.left
125 leftOffset = currentRect.left - originalRect.left
124 topOffset = currentRect.top - originalRect.top
126 topOffset = currentRect.top - originalRect.top
125− case i == arg, down, overlapsOther of
127+ case down, overlapsOther of
126− true, true, _ ->
128+ true, _
127− defaultSprings
130+ defaultSprings
128− { x = mx + leftOffset
131+ { x = mx + leftOffset
129− , y = my + topOffset
132+ , y = my + topOffset
130− , zIndex = 1
133+ , zIndex = 1
131− , transform = scaledUp
134+ , transform = scaledUp
132− , shadow = 20
135+ , shadow = 20
133− , immediate = \n -> n == "x" || n == "y" || n == "zIndex"
136+ , immediate = \n -> n == "x" || n == "y" || n == "zIndex"
135− false, true, Just { index, value }
138+ true, Just { index, value }
136 | index == i ->
139 | index == i ->
137 defaultSprings
140 defaultSprings
138 { x = rectDragged.left - currentRect.left + leftOffset
141 { x = rectDragged.left - currentRect.left + leftOffset
139 , y = rectDragged.top - currentRect.top + topOffset
142 , y = rectDragged.top - currentRect.top + topOffset
140 , immediate = const false
143 , immediate = const false
142− _, _, _ ->
145+ _, _ ->
143 defaultSprings
146 defaultSprings
144 { x = leftOffset
147 { x = leftOffset
145 , y = topOffset
148 , y = topOffset
@@ -187,8 +190,8 @@ makeComponent = do
188 theme ∷ CSSTheme <- useTheme
191 theme ∷ CSSTheme <- useTheme
189 bindDragProps <-
192 bindDragProps <-
190− useDrag (justifill { filterTaps: true }) \{ arg, down, movement: mx /\ my } ->
193+ useDrag (justifill { filterTaps: true }) \{ arg, down, movement: mx /\ my, tap } ->
191− springsteen init rectsRef positionsRef arg mx my down springs
194+ springsteen init windowSize rectsRef positionsRef arg mx my down tap springs
193 renderSpells =
196 renderSpells =
194 mapWithIndex \i (spell /\ style) ->
197 mapWithIndex \i (spell /\ style) ->
@@ -205,7 +208,8 @@ makeComponent = do
205 `withDragProps`
208 `withDragProps`
206 bindDragProps i
209 bindDragProps i
208− $ jsx grid {} (renderSpells (spells `zip` springs.styles))
212+ $ renderSpells (spells `zip` springs.styles)
210foreign import unsafeArraySetAt ∷ ∀ a. Int -> a -> Array a -> Array a
214foreign import unsafeArraySetAt ∷ ∀ a. Int -> a -> Array a -> Array a