diff --git a/js/angular/service/attachDrag.js b/js/angular/service/attachDrag.js index 187c91d296..f1350d40bb 100644 --- a/js/angular/service/attachDrag.js +++ b/js/angular/service/attachDrag.js @@ -25,8 +25,12 @@ IonicModule ionic.offGesture(dragEndGesture, 'dragend', handleDragEnd); }); + var isDragging = false; element.on('touchmove pointermove mousemove', function(ev) { - if (dragState && dragState.dragging) ev.preventDefault(); + if (isDragging) ev.preventDefault(); + }); + element.on('touchend mouseup mouseleave', function(ev) { + isDragging = false; }); var dragState; @@ -50,7 +54,7 @@ IonicModule handleDragEnd(ev); return; } - dragState.dragging = true; + isDragging = true; var percent = getDragPercent(ev.gesture.center.pageX); opts.onDrag(percent);