PuruVJ / neodrag

One Draggable to rule them all 💍

Home Page:https://neodrag.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

adjusting on window resize

FractalHQ opened this issue · comments

Draggables don't seem to react to window resize events.

They can become lost outside of the boundary because of this.

Not sure if this is because of something I've done on my end though.

I've thought about this, and not sure how I want to tackle this. If you take draggable outside the svelte REPL examples and leave them here, they stay there. That much is predictive.

But if you have set the bounds, and resize causes it to go out of the bounds, then that is a possible issue. Should work on that. Thanks for letting me know. Will be using resizeObserver for this

I had a similar problem, and I wanted to use drag to change the position without transform/translate. If we're able to do that, I could imagine using the left/top positioning properties to position it as a % of the parent. (The draggable elements would be absolutely positioned on a parent that scales with the window size.)

@PuruVJ , would you be open to exposing a custom style function? Like the custom transform that currently exists.

I had a similar problem, and I wanted to use drag to change the position without transform/translate. If we're able to do that, I could imagine using the left/top positioning properties to position it as a % of the parent. (The draggable elements would be absolutely positioned on a parent that scales with the window size.)

@PuruVJ , would you be open to exposing a custom style function? Like the custom transform that currently exists.

You can do that with custom transform. If you don't return anything, no styles will be applied. You can directly apply rootNode.style.top in customTransform

Ah, I missed that, thanks. That's perfect-- it works!