PuruVJ / neodrag

One Draggable to rule them all 💍
https://neodrag.dev
MIT License
1.59k stars 48 forks source link

Can the magnetic mode be realized? #120

Open MineYuanlu opened 1 year ago

MineYuanlu commented 1 year ago

I have an idea that when I drag an element, it can be "adsorbed" when it is close to another element. I try to judge whether the distance is less than the fixed value on the onDrag, set the grid and position when approaching, and cancel the grid when leaving. But I failed. Setting the position seems to have no effect. I don't know why. At the same time, the grid doesn't seem to be perfectly aligned @neodrag/svelte: 2.0.3