ng2-dragula icon indicating copy to clipboard operation
ng2-dragula copied to clipboard

Disable dragging while scrolling

Open olivier-po opened this issue 7 years ago • 2 comments

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.

olivier-po avatar Dec 07 '17 23:12 olivier-po

I'll just point you here:

https://github.com/cormacrelf/dragula-touch-demo/blob/master/src/app/delay-drag.directive.ts

cormacrelf avatar Jun 28 '18 13:06 cormacrelf

@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 ?

chetankh23 avatar Nov 29 '18 16:11 chetankh23