clauderic / dnd-kit

The modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
http://dndkit.com
MIT License
13.06k stars 648 forks source link

Autoscroll - Improve acceleration configuration #939

Open RemyMachado opened 1 year ago

RemyMachado commented 1 year ago

Currently, we have two containers in the same DndContext.

The acceleration can't be configured on a per-container basis, thus we have an acceleration too slow for one, and too fast for the other.

We need a way to configure the scroll speed differently for each container. A method similar to autoScroll.canScroll that would return the default acceleration or a computed one.

Hypothetical usage:

// `DndContext` config
computeAcceleration(element, defaultAcceleration) {
     if (element.id === 'slow-container-id') {
          return 2;
     }
     if (element.id === 'fast-container-id') {
          return 15;
     }

     return defaultAcceleration
}
aaron-montra commented 1 year ago

I would also love to see something like this implemented.