taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)
http://interactjs.io/
MIT License
12.38k stars 785 forks source link

I got a little movment when i set interact.createSnapGrid({ x: 30, y: 30 }) #173

Closed nightost closed 9 years ago

nightost commented 9 years ago

it also appears in http://interactjs.io/ 's Snapping demo. The first step is less than x value in my settings.

taye commented 9 years ago

I don't understand what the problem is. Could you explain it a bit more.

nightost commented 9 years ago

Forgive my poor english~ For example,i set x value to 30 using createSnapGrid. As expected,the dragable element's every step on x-axis will be 30. But ,the first step is less than 30(always about 5) when i draged.

taye commented 9 years ago

You need to use 'startCoords' as the snap.offset. http://interactjs.io/docs/snapping/#offset