vnphanquang / svelte-put

Useful svelte stuff to put in your projects

Home Page:https://svelte-put.vnphanquang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Movable - Cannot limit delta for only 1 axis.

axekan opened this issue · comments

commented

Repl: https://svelte.dev/repl/f953c2b739d549a28c167872a2e9df03?version=4.2.10

My use case is a movable that can only be moved on the x-axis. My issues are these:

  • The x value in delta cannot be omitted (since that gives an error), so I have to set that to something arbitrary too.
  • Setting y to '0px' makes the delta not apply at all. I can set it to something small like 1px, but I would like to avoid that entirely.

I would like to to just be able to:

<div
    use:movable={{ limit: { delta: { y: '0px' } } }}>
    ...
</div>

Is there a workaround to be able to do this currently?

@axekan Hello there. Thanks for the report. That was indeed not accounted for previously but is now doable in the newly released v3.2.0.

Your REPL now works as expected. You can also just set limit.detla.y to 0 instead of '0px' to save a few keystrokes.

Happy coding!


p.s closing for now but feel free to reopen / continue discussion if necessary. Thanks!