tajo / react-movable

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

Autoscrolling logic need some fixes #80

Closed cc-ebay closed 8 months ago

cc-ebay commented 2 years ago

In smaller container the autoscrolling logic does not work well. The problem is partially related to AUTOSCROLL_ACTIVE_OFFSET hardcoded to 200px but even the increment logic need some fix.

It would be a good idea if the AUTOSCROLL_ACTIVE_OFFSET was a ratio of the scrollable area (ex: 1/3 or 1/4) or a more complex expression that always preserve enough space that is not in the autoscroll area. And even more important do not create overlap between the top and bottom offsets.

Otherwise you can have problems like this:

react-movable-autoscrolling-problem1

Notice the jumps up and down even without moving the cursor.

cc-ebay commented 2 years ago

This seems partially addressed by https://github.com/tajo/react-movable/pull/78

cc-ebay commented 2 years ago

Another minor problem is if you drag an element at the top or the bottom of the viable area (inside the scrolling offset), it starts scrolling super fast. It would be great if the component was able to mitigate the initial scrolling speed until the user send a clear intention of the direction he wants to scroll.