dnd-multi-backend icon indicating copy to clipboard operation
dnd-multi-backend copied to clipboard

Transition on state changes.

Open shashtag opened this issue 10 months ago • 3 comments

I am tracking is ctrl is pressed using a state in react, I want that the transition happens when the state updates.

shashtag avatar Apr 16 '24 23:04 shashtag

Hi @shashtag,

I am not sure I understand. Could you explain in bit more details what you want to achieve and how it relates to dnd-multi-backend?

LouisBrunner avatar Apr 17 '24 09:04 LouisBrunner

We were using react-dnd-html5-backend when we encountered a problem where we could not drop while the CTRL key is pressed.

We tried multiple ways to fix that but none of them worked. Finally we decided to use the touch backend.

We found that touch backend is not as performant as the HTML5Backend

We think if we could change the backend when CTRL is pressed to touch backend, we would be able to keep our functionality as well have the snappiness of HTML5Backend when CTRL is not press.

shashtag avatar Apr 18 '24 11:04 shashtag

Which pipeline are you using? rdndmb-html5-to-touch?

In any case, if you create your own pipeline you can easily customize the events that trigger the switch between HTML5 and Touch. See how the current functions are defined here: https://github.com/LouisBrunner/dnd-multi-backend/blob/main/packages/dnd-multi-backend/src/transitions.ts

LouisBrunner avatar Apr 18 '24 17:04 LouisBrunner