You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`isThrowOut`| Invoked in the event of `dragend`. Determines if element is being thrown out of the stack. | Element is considered to be thrown out when `throwOutConfidence` is equal to 1. |
126
-
|`allowedDirections`| Array of directions in which cards can be thrown out. |[Direction.LEFT, Direction.RIGHT]. |
130
+
|`allowedDirections`| Array of directions in which cards can be thrown out. |[Direction.DOWN, Direction.LEFT, Direction.RIGHT, Direction.UP]. |
127
131
|`throwOutConfidence`| Invoked in the event of `dragmove`. Returns a value between 0 and 1 indicating the completeness of the throw out condition. | Ration of the absolute distance from the original card position and element width. |
128
132
|`throwOutDistance`| Invoked when card is added to the stack. The card is thrown to this offset from the stack. | The value is a random number between `minThrowOutDistance` and `maxThrowOutDistance`. |
129
133
|`minThrowOutDistance`| In effect when `throwOutDistance` is not overwritten. | 450. |
|`stack.getCard(element)`| Returns card associated with an element. |
148
152
|`stack.on(event, listener)`| Attaches an [event listener](#events). |
149
153
|`card.on(event, listener)`| Attaches an [event listener](#events). |
150
-
|`card.throwIn(x, y)`| Throws a card into the stack from an arbitrary position. `x, y` is the position at the start of the throw. |
151
-
|`card.throwOut(x, y)`| Throws a card out of the stack in the direction away from the original offset. `x, y` is the position at the start of the throw. |
154
+
|`card.throwIn(coordinateX, coordinateY)`| Throws a card into the stack from an arbitrary position. `coordinateX, coordinateY` is the position at the start of the throw. |
155
+
|`card.throwOut(coordinateX, coordinateY)`| Throws a card out of the stack in the direction away from the original offset. `coordinateX, coordinateY` is the position at the start of the throw. |
152
156
|`card.destroy()`| Unbinds all Hammer.Manager events. Removes the listeners from the physics simulation. |
153
157
154
158
### Throwing Card Out of the Stack
155
159
156
-
Use the `card.throwOut(x, y)` method to throw the card out of the stack. Offset the position to whatever direction you want to throw the card, e.g.
160
+
Use the `card.throwOut(coordinateX, coordinateY)` method to throw the card out of the stack. Offset the position to whatever direction you want to throw the card, e.g.
157
161
158
162
```js
159
163
card.throwOut(Card.DIRECTION_LEFT, 0);
160
164
card.throwOut(Card.DIRECTION_RIGHT, 0);
161
165
```
162
166
163
-
To make the animation more diverse, use random value for the `y` parameter.
167
+
To make the animation more diverse, use random value for the `coordinateY` parameter.
@@ -194,19 +200,11 @@ Event listener is invoked with a single `eventObject` parameter:
194
200
```js
195
201
conststack=Swing.Stack();
196
202
197
-
stack.on('throwout', function(eventObject) {});
203
+
stack.on('throwout', (eventObject)=> {});
198
204
```
199
205
200
206
| Name | Value |
201
207
| --- | --- |
202
208
|`target`| The element being dragged. |
203
-
|`direction`| The direction in which the element is being dragged: `Card.DIRECTION_LEFT`or `Card.DIRECTION_RIGHT`. |
209
+
|`direction`| The direction in which the element is being dragged: `Card.DIRECTION_DOWN`, `Card.DIRECTION_LEFT`, `Card.DIRECTION_RIGHT`or `Card.DIRECTION_UP`. |
204
210
|`throwOutConfidence`| A value between 0 and 1 indicating the completeness of the throw out condition. |