PuruVJ / neodrag

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

`position` does not work with tweened store #167

Closed khromov closed 3 months ago

khromov commented 3 months ago

Repro: https://svelte.dev/repl/035ab677b08d48a09830d43dcab4784d?version=4.2.18

The "Dog" element is supposed to snap back to the original position if it's dragged and not placed inside the circle, however it does not work, the transform property does not change even though we are using the tweened store and can see the store is being continuously updated.

I am using exactly the same approach as the docs page: https://github.com/PuruVJ/neodrag/blob/a9b7ac8147a4012192ff33e95d1e186ae367639b/docs/src/components/home/HeroExample.svelte#L60C4-L60C28

khromov commented 3 months ago

After some research I managed to get a hint from https://github.com/PuruVJ/neodrag/issues/122

The config is not reactive when set in a variable inside the script tag, it has to be done with an inline object on use:draggable: https://svelte.dev/repl/035ab677b08d48a09830d43dcab4784d?version=4.2.18