v0.3.0
This version introduces swap modes and new swap events.
Features
swapMode
(#53, #31)
Swapy now has 3 different swapping modes: hover
, stop
, and drop
.
hover
(default): swaps items as soon as you hover over slots.stop
: swaps items when you hover over a slot and stop moving the cursor.drop
: swaps the item when you drop it over a slot.
Example:
createSwapy(container, { swapMode: 'drop' })
Note: Before this version, the stop
mode was enabled by disabling continuousMode
. It’s now recommended to use swapMode: 'stop'
instead, as continuousMode
will soon be deprecated.
New swap events (#58, #64)
swapy.onSwapEnd((event) => {})
: fires when you drop the item. It will include the last slot items' order in the event.data
object.
swapy.onSwapStart(() => {})
: fires when you start dragging any item. It will only trigger once per dragging session.