Commit de1ba55d authored by Valentin Hervieu's avatar Valentin Hervieu

Fix onEnd event being sent several times on non-mobiles devices

parent 88e31f53
......@@ -1777,12 +1777,10 @@
this.focusElement(pointer);
ehMove = angular.bind(this, this.dragging.active ? this.onDragMove : this.onMove, pointer);
ehEnd = angular.bind(this, this.onEnd, ehMove);
$document.on(eventNames.moveEvent, ehMove);
ehEnd = angular.bind(this, this.onEnd, ehMove, ehEnd);
$document.on(eventNames.moveEvent, ehMove)
$document.on(eventNames.endEvent, ehEnd);
this.ehEndToBeRemovedOnEnd = ehEnd;
this.callOnStart();
var changedTouches = this.getEventAttr(event, 'changedTouches');
......@@ -1842,10 +1840,11 @@
* onEnd event handler
*
* @param {Event} event The event
* @param {Function} ehMove The the bound move event handler
* @param {Function} ehMove The bound move event handler
* @param {Function} ehEnd The bound end event handler
* @returns {undefined}
*/
onEnd: function(ehMove, event) {
onEnd: function(ehMove, ehEnd, event) {
var changedTouches = this.getEventAttr(event, 'changedTouches');
if (changedTouches && changedTouches[0].identifier !== this.touchId) {
return;
......@@ -1853,11 +1852,6 @@
this.isDragging = false;
this.touchId = null;
// Touch event, the listener was added by us so we need to remove it
$document.off("touchend", this.ehEndToBeRemovedOnEnd);
var moveEventName = this.getEventNames(event).moveEvent;
if (!this.options.keyboardSupport) {
this.minH.removeClass('rz-active');
this.maxH.removeClass('rz-active');
......@@ -1865,7 +1859,9 @@
}
this.dragging.active = false;
$document.off(moveEventName, ehMove);
var eventName = this.getEventNames(event);
$document.off(eventName.moveEvent, ehMove);
$document.off(eventName.endEvent, ehEnd);
this.callOnEnd();
},
......
This diff is collapsed.
......@@ -1781,12 +1781,10 @@
this.focusElement(pointer);
ehMove = angular.bind(this, this.dragging.active ? this.onDragMove : this.onMove, pointer);
ehEnd = angular.bind(this, this.onEnd, ehMove);
$document.on(eventNames.moveEvent, ehMove);
ehEnd = angular.bind(this, this.onEnd, ehMove, ehEnd);
$document.on(eventNames.moveEvent, ehMove)
$document.on(eventNames.endEvent, ehEnd);
this.ehEndToBeRemovedOnEnd = ehEnd;
this.callOnStart();
var changedTouches = this.getEventAttr(event, 'changedTouches');
......@@ -1846,10 +1844,11 @@
* onEnd event handler
*
* @param {Event} event The event
* @param {Function} ehMove The the bound move event handler
* @param {Function} ehMove The bound move event handler
* @param {Function} ehEnd The bound end event handler
* @returns {undefined}
*/
onEnd: function(ehMove, event) {
onEnd: function(ehMove, ehEnd, event) {
var changedTouches = this.getEventAttr(event, 'changedTouches');
if (changedTouches && changedTouches[0].identifier !== this.touchId) {
return;
......@@ -1857,11 +1856,6 @@
this.isDragging = false;
this.touchId = null;
// Touch event, the listener was added by us so we need to remove it
$document.off("touchend", this.ehEndToBeRemovedOnEnd);
var moveEventName = this.getEventNames(event).moveEvent;
if (!this.options.keyboardSupport) {
this.minH.removeClass('rz-active');
this.maxH.removeClass('rz-active');
......@@ -1869,7 +1863,9 @@
}
this.dragging.active = false;
$document.off(moveEventName, ehMove);
var eventName = this.getEventNames(event);
$document.off(eventName.moveEvent, ehMove);
$document.off(eventName.endEvent, ehEnd);
this.callOnEnd();
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment