akserg / ng2-dnd

Angular 2 Drag-and-Drop without dependencies
MIT License
838 stars 251 forks source link

ng2-dnd is not working in Touch devices. #113

Open sunpasup opened 7 years ago

sunpasup commented 7 years ago

i am using this ng2-dnd in my angular2 Project. it works fine in dekstop. i have this to work in Touch devices also. is there any way to do that.

Please Respond if there is any hacks

CarlosAyala commented 7 years ago

I'm having the same problem here, on Ionic Framework 2.

sunpasup commented 7 years ago

any one?? i am still looking for solution for above case.

i am using this ng2-dnd in my angular2 Project. it works fine in dekstop. i have this to work in Touch devices also. is there any way to do that.

Please Respond if there is any hacks

Ledzz commented 7 years ago

@sunpasup you can use https://github.com/timruffles/ios-html5-drag-drop-shim to emulate drag events on mobile devices

meltsas commented 7 years ago

@Ledzz ios-html5-drag-drop-shim is useless, even its demo didn't work. How can You use it with ng2-dnd, can You provide any example?

Ledzz commented 7 years ago

@meltsas here's slightly modified code to run in typescript: https://gist.github.com/Ledzz/a688925e21014bc71711bfd7dc8ba24b

Then in OnIinit hook you can use it like this:

new DragDropShim({holdToDrag: 300}, document);

Code might not be ready for production!

meltsas commented 7 years ago

@Ledzz I tried Chrome DevTool Touch Emulator (not with actual device) and it didn't work, but Thank You for trying to help. Maybe I am missing something but I thought the demo ( http://timruffles.github.io/ios-html5-drag-drop-shim/enter-leave/) suppose to work with touch device - instead of drag it scrolls (with Chrome devTool emulator) .

jeewendrakumar commented 7 years ago

no support for devices

svcninja commented 7 years ago

I tried out the [(http://timruffles.github.io/ios-html5-drag-drop-shim)], got the same result as @meltsas. Dragula seems to be working fine. +1

svcninja commented 7 years ago

@Ledzz Tried in both ios and android. Not working. Are there any other options, rather than the http://timruffles.github.io/ios-html5-drag-drop-shim ?

PierreDugue commented 7 years ago

@svcninja I tried Dragula on my Android. The drag and drop is working but the drag trigger the scrolling at the same time. Is it working fine for you?

dragoplut commented 7 years ago

Have the same with Dragula and Android srcolling issue. While drag, screen is moving/scrolling up and down and no way to drag item up and down.

PierreDugue commented 7 years ago

@dragoplut Hi, I found a trick for this issue. Just add the following code in your CSS.

.yourDivName{ touch-action: none; }

dragoplut commented 7 years ago

@PierreDugue Thanks a lot. Your solution worked for me :-)

matte00 commented 7 years ago

@PierreDugue Thanks a lot. It's works on Android but still doesn't works on iOS :(

EDIT: With this works on iOS too:

Install this on your project: iOS shim for HTML 5 drag'n'drop npm install --save drag-drop-webkit-mobile

Then in your polyfills file put: var iosDragDropShim = require('drag-drop-webkit-mobile'); let options = { enableEnterLeave: true,holdToDrag: 300 }; iosDragDropShim(options);

It's works! :)