react-native-draggable
react-native-draggable copied to clipboard
Draggable with Grid
To add grid or grid-like snap functionality I made a modification to the Draggable.js
in the handleOnDrag on line 124 I added
const changeX = clamp(
Math.round(dx /25) * 25,
...
)
and
const changeY = clamp(
Math.round(dy / 25) * 25,
...
)
(Values can be changed depending on grid-size, 25 being a 25px grid)
Although the behavior is as expected, it feels a bit too "snappy" — Any suggestions on how I could modify it to transition to each new grid slot instead of instantly snap to each new grid slot?
Thanks