ng2-dragula
ng2-dragula copied to clipboard
Disable dragging while scrolling
My goal is to stop the dragging while the user is scrolling.
I implemented a strategy where I use hammer.js to detect a long press on the element I want to move in order to activate the dragging after the long press. (As it is on Android home when you want to move an app). So it doesn't impact the scrolling, since the user needs to stay pressed for a few seconds on the element to drag it somewhere else.
It got me nowhere since I can't activate /desactivate dragging dynamically with ng2-dragula. What I would love to do is :
this.dragulaService.setOptions('cards-bag', {
moves: function () {
return this.canMove;
}
});
where canMove would be a variable I could set dynamically.
I don't know how to achieve it. I checked #784, but it doesn't help that much.
I'll just point you here:
https://github.com/cormacrelf/dragula-touch-demo/blob/master/src/app/delay-drag.directive.ts
@olivier-po Did you figure out how to activate dragging after long press. I am looking for a solution where component is enabled for dragging at run time ?