|
|
@ -55,11 +55,6 @@ |
|
|
|
, slice = [].slice |
|
|
|
, slice = [].slice |
|
|
|
|
|
|
|
|
|
|
|
, touchDragOverListeners = [] |
|
|
|
, touchDragOverListeners = [] |
|
|
|
|
|
|
|
|
|
|
|
, pointerdown |
|
|
|
|
|
|
|
, pointerup |
|
|
|
|
|
|
|
, pointermove |
|
|
|
|
|
|
|
, pointercancel |
|
|
|
|
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -99,18 +94,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Detect IE10/IE11+
|
|
|
|
|
|
|
|
if (window.onpointerdown !== undefined) { |
|
|
|
|
|
|
|
pointerdown = 'pointerdown'; |
|
|
|
|
|
|
|
pointerup = 'pointerup'; |
|
|
|
|
|
|
|
pointermove = 'pointermove'; |
|
|
|
|
|
|
|
pointercancel = 'pointercancel'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
pointerdown = 'MSPointerDown'; |
|
|
|
|
|
|
|
pointerup = 'MSPointerUp'; |
|
|
|
|
|
|
|
pointermove = 'MSPointerMove'; |
|
|
|
|
|
|
|
pointercancel = 'MSPointerCancel'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Bind events
|
|
|
|
// Bind events
|
|
|
|
_on(el, 'add', options.onAdd); |
|
|
|
_on(el, 'add', options.onAdd); |
|
|
@ -125,10 +108,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
_on(el, 'dragover', this._onDragOver); |
|
|
|
_on(el, 'dragover', this._onDragOver); |
|
|
|
_on(el, 'dragenter', this._onDragOver); |
|
|
|
_on(el, 'dragenter', this._onDragOver); |
|
|
|
_on(el, pointerdown, this._onTapStart); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_css(el, 'touch-action', 'none'); |
|
|
|
|
|
|
|
_css(el, '-ms-touch-action', 'none'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
touchDragOverListeners.push(this._onDragOver); |
|
|
|
touchDragOverListeners.push(this._onDragOver); |
|
|
|
} |
|
|
|
} |
|
|
@ -143,7 +122,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onTapStart: function (evt/**Event|TouchEvent|PointerEvent*/){ |
|
|
|
_onTapStart: function (evt/**Event|TouchEvent*/){ |
|
|
|
var |
|
|
|
var |
|
|
|
touch = evt.touches && evt.touches[0] |
|
|
|
touch = evt.touches && evt.touches[0] |
|
|
|
, target = (touch || evt).target |
|
|
|
, target = (touch || evt).target |
|
|
@ -184,10 +163,6 @@ |
|
|
|
evt.preventDefault(); |
|
|
|
evt.preventDefault(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (evt.type == 'pointerdown' || evt.type == 'MSPointerDown') { |
|
|
|
|
|
|
|
this._onDragStart(tapEvt, true); |
|
|
|
|
|
|
|
evt.preventDefault(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_on(this.el, 'dragstart', this._onDragStart); |
|
|
|
_on(this.el, 'dragstart', this._onDragStart); |
|
|
|
_on(this.el, 'dragend', this._onDrop); |
|
|
|
_on(this.el, 'dragend', this._onDrop); |
|
|
@ -240,19 +215,22 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onTouchMove: function (evt/**TouchEvent|PointerEvent*/){ |
|
|
|
_onTouchMove: function (evt/**TouchEvent*/){ |
|
|
|
if( tapEvt ){ |
|
|
|
if( tapEvt ){ |
|
|
|
var |
|
|
|
var |
|
|
|
touch = evt.touches[0] |
|
|
|
touch = evt.touches[0] |
|
|
|
, dx = touch.clientX - tapEvt.clientX |
|
|
|
, dx = touch.clientX - tapEvt.clientX |
|
|
|
, dy = touch.clientY - tapEvt.clientY |
|
|
|
, dy = touch.clientY - tapEvt.clientY |
|
|
|
|
|
|
|
, translate3d = 'translate3d(' + dx + 'px,' + dy + 'px,0)' |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
touchEvt = touch; |
|
|
|
touchEvt = touch; |
|
|
|
_css(ghostEl, 'webkitTransform', 'translate3d('+dx+'px,'+dy+'px,0)'); |
|
|
|
|
|
|
|
_css(ghostEl, 'mozTransform', 'translate3d('+dx+'px,'+dy+'px,0)'); |
|
|
|
_css(ghostEl, 'webkitTransform', translate3d); |
|
|
|
_css(ghostEl, 'msTransform', 'translate3d('+dx+'px,'+dy+'px,0)'); |
|
|
|
_css(ghostEl, 'mozTransform', translate3d); |
|
|
|
_css(ghostEl, 'transform', 'translate3d('+dx+'px,'+dy+'px,0)'); |
|
|
|
_css(ghostEl, 'msTransform', translate3d); |
|
|
|
|
|
|
|
_css(ghostEl, 'transform', translate3d); |
|
|
|
|
|
|
|
|
|
|
|
evt.preventDefault(); |
|
|
|
evt.preventDefault(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -297,9 +275,6 @@ |
|
|
|
_on(document, 'touchmove', this._onTouchMove); |
|
|
|
_on(document, 'touchmove', this._onTouchMove); |
|
|
|
_on(document, 'touchend', this._onDrop); |
|
|
|
_on(document, 'touchend', this._onDrop); |
|
|
|
_on(document, 'touchcancel', this._onDrop); |
|
|
|
_on(document, 'touchcancel', this._onDrop); |
|
|
|
_on(document, pointermove, this._onTouchMove); |
|
|
|
|
|
|
|
_on(document, pointerup, this._onDrop); |
|
|
|
|
|
|
|
_on(document, pointercancel, this._onDrop); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._loopId = setInterval(this._emulateDragOver, 150); |
|
|
|
this._loopId = setInterval(this._emulateDragOver, 150); |
|
|
|
} |
|
|
|
} |
|
|
@ -378,9 +353,6 @@ |
|
|
|
_off(document, 'touchmove', this._onTouchMove); |
|
|
|
_off(document, 'touchmove', this._onTouchMove); |
|
|
|
_off(document, 'touchend', this._onDrop); |
|
|
|
_off(document, 'touchend', this._onDrop); |
|
|
|
_off(document, 'touchcancel', this._onDrop); |
|
|
|
_off(document, 'touchcancel', this._onDrop); |
|
|
|
_off(document, pointermove, this._onTouchMove); |
|
|
|
|
|
|
|
_off(document, pointerup, this._onDrop); |
|
|
|
|
|
|
|
_off(document, pointercancel, this._onDrop); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( evt ){ |
|
|
|
if( evt ){ |
|
|
@ -437,7 +409,6 @@ |
|
|
|
_off(el, 'mousedown', this._onTapStart); |
|
|
|
_off(el, 'mousedown', this._onTapStart); |
|
|
|
_off(el, 'touchstart', this._onTapStart); |
|
|
|
_off(el, 'touchstart', this._onTapStart); |
|
|
|
_off(el, 'selectstart', this._onTapStart); |
|
|
|
_off(el, 'selectstart', this._onTapStart); |
|
|
|
_off(el, pointerdown, this._onTapStart); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_off(el, 'dragover', this._onDragOver); |
|
|
|
_off(el, 'dragover', this._onDragOver); |
|
|
|
_off(el, 'dragenter', this._onDragOver); |
|
|
|
_off(el, 'dragenter', this._onDragOver); |
|
|
|