vue-draggable-nested-tree
vue-draggable-nested-tree copied to clipboard
Can you support touch events for dragging and dropping ?
Hey, can the draggable tree support touch for drag and drop?
ok, i will try that today
great thanks, it should be a matter of adding the touch event listeners to your draggablehelper ?
@shaydoc yes. i tried, branch dev-mobile: https://github.com/phphe/vue-draggable-nested-tree/tree/dev-mobile. There is an issue, the page will move when drag
@phphe did you have any joy looking at making the control touch enabled ?
@shaydoc yes. So I created the branch dev-mobile. There are some bugs.
Cool
I did some touch stuff yesterday, jquery.nestable handles it well
https://github.com/RamonSmit/Nestable2/blob/master/jquery.nestable.js
@shaydoc I merged mobile in latest version. There is an issue: page scrolling on drag. I don't have any idea now.
@phphe I found that using mouse/touch position solves this rather nicely, any thoughts?
`function resolveDragedElAndInitialPosition(e) { var el0 = opt.getEl ? opt.getEl(dragHandlerEl, opt) : dragHandlerEl; var el = el0;
if (opt.clone) { store.triggerEl = el0; el = el0.cloneNode(true); el0.parentElement.appendChild(el); }
var pos = offsetToPosition(el, getOffset(el0)); pos.y = e.pageY; return { position: pos, el: el }; }`
@shaydoc try latest 2.1.3
@phphe There is still an issue on mobile when page has scroll. Not always. But drag is happening only when we carefully drag the item. I am using version 2.2.17. Any workarounds?
Thank you for this nice library btw.
@phphe Seem to work fine, if we do preventDefault on item/handle's touchstart & touchmove events. I have currently done it on item slot which works for me. But I can raise a pull-request by adding those in code. Please let me know.
@ram33 awesome. please raise it, i will check that.
@phphe please check https://github.com/phphe/vue-draggable-nested-tree/pull/71