No 'drag' event listener
Closed this issue · 2 comments
Thanks for the great package.
I noticed it was not detecting the 'drag' event, which I am using for my own functionality instead of 'dragenter', 'dragleave', 'dragover', or 'drop'. Since I am not using those other events I changed the code in DragDropTouch.js to dispatch 'drag' event on touchmove and ignore if (target != this._lastTarget)
because I am simply handling it using screen positioning.
I also had to make a minor change in my code since the 'drag' event has event.offsetX
but this new touchmove dispatch did not. I just updated my code like so if (e.offsetX === undefined && e.clientX) offsetX = e.clientX;
and it works perfectly.
Anyway, it would be nice if this just worked in case people need to use that event in addition to detecting when the drop target has changed. I am using jquery and only have three events: $("#myElement").on("dragstart", ...) , $("#myElement").on("drag", ...) , and $("#myElement").on("dragend", ...)
Glad you like the library.
I will add the offsetX/Y properties to the event as you suggested, nice catch!
Thank you!
I'm closing this mostly because of how much time has passed and how much the code has changed since this issue was filed. If this is still a concern, please file a new issue. I recently signed on to this project and would like to make sure we're covering all the bases, while also making sure there are no lingering issues based on old code.