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

Drag and Scroll not working togeather

Open dnduser opened this issue 7 years ago • 3 comments

Hi,

On element Drag..its not scrolling down once it reaches the bottom of the Div. Is there any workaround for this?.

Issue is in all the browsers.

dnduser avatar Oct 12 '17 07:10 dnduser

Bottom of div or page?

BTW issue is not there with plugin but a missing feature of Safari and other browsers. Also in Chrome and Firefox it works as both of these browsers have this feature inbuilt!

Thanks, Abhishek.

abhishekdgeek avatar Oct 12 '17 07:10 abhishekdgeek

Its bottom of the Div. I have my app in chrome and firefox only. The behaviour is not consistent ..it works only sometimes but not always.

I have used dnd everywhere in my project. Its difficult use some other component. Is there any workaround, can we implement scroll on drag in angular 2 while using dnd.

dnduser avatar Oct 12 '17 18:10 dnduser

As workaround I use code below, it scrolls page up/down. For dnd-draggable: (drag)="dragHandler($event)"

and handler:

dragHandler(event){
    var offset = 150;
    var scrollValueDown = 10;
    var scrollValueUp = -1*scrollValueDown;
    if(event.screenY > 0 && event.screenY < offset){
      window.scrollBy(0, scrollValueUp) // up
    }

    if(event.screenY > (window.outerHeight - offset) && event.screenY < window.outerHeight){
      window.scrollBy(0, scrollValueDown) // down
    }
  }

for information

gtimur7 avatar Mar 12 '18 14:03 gtimur7