tajo / react-movable

🔀 Drag and drop for your React lists and tables. Accessible. Tiny.
https://react-movable.pages.dev
MIT License
1.53k stars 51 forks source link

Improve autoscroll on short windows/containers #102

Closed IanVS closed 6 months ago

IanVS commented 6 months ago

Fixes https://github.com/tajo/react-movable/issues/68 Fixes https://github.com/tajo/react-movable/issues/80 Closes https://github.com/tajo/react-movable/pull/78

Rather than expose more configuration options to the user, this adds a movement threshold so that autoscroll does not happen until the item has been dragged more than 10 pixels, and ensures it autoscrolls only in the correct direction.

Furthermore, the scroll speed is also adjusted for these cases, so that the speed is not so high when the starting position of the scroll is within the AUTOSCROLL_ACTIVE_OFFSET.

I confirmed that this does not break existing scroll behavior in tall containers / windows, and I added an example for this ("Scrolling container short"), but I'm not sure whether it's worth committing it or not. I included it so that you could easily test out the fixes here, @tajo.

tajo commented 6 months ago

Thanks! Published as 3.2.0.