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

Promoted AUTOSCROLL_ACTIVE_OFFSET and AUTOSCROLL_SPEED_RATIO to props #78

Closed peterkogo closed 8 months ago

peterkogo commented 2 years ago

After a long search for a simple, extensible, reliable, mobile-ready drag-and-drop-list implementation with variable height support - I found this beautiful little project.

Only thing really preventing this from being 100% extensible and awesome are those hardcoded values mentioned in #68.

Hopefully I got this right. Current implementations shouldn't break because the previously hardcoded values are now the default values.

tajo commented 2 years ago

@PeterKey Can you rebase master? It should fix the CI.

You should also update the documentation.

peterkogo commented 2 years ago

@tajo Sure, can do. Will have some time this weekend.

peterkogo commented 2 years ago

@cc-ebay In my opinion, the autoscroll behaviour should not change if the scroll container resizes in height. I want to set a fixed pixel value from top/bottom where autoscrolling should commence, so I can optimise it how it feels. This should not change over different screen sizes.

I agree with you however when the scroll containers size gets smaller than 2x the autoscrollActiveOffset. Here problems arise and autoscroll behaviour should default to a ratio.

Now that I think about it, this might also apply if list items are bigger than the scroll container in general: It might make sorting impossible because the list would always scroll. But this is a very weird edge case, that somehow defeats the idea behind a list anyway.

tajo commented 2 years ago

The auto-scrolling behavior could be definitely better & work for more cases. If someone wants to research and implement it (including tests for various scenarios), I am open to it. I think "just works" approach makes more sense than letting users customize it.