@odopod/odo-pointer
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("tiny-emitter"),require("@odopod/odo-device"),require("@odopod/odo-helpers")):"function"==typeof define&&define.amd?define(["tiny-emitter","@odopod/odo-device","@odopod/odo-helpers"],e):t.OdoPointer=e(t.TinyEmitter,t.OdoDevice,t.OdoHelpers)}(this,function(t,e,i){"use strict";function n(t){return t===p.Axis.X}function s(t){return t===p.Axis.Y}function o(t){return t===p.Axis.BOTH}function r(t){return t!==p.Direction.NONE}function a(t){return Number.isFinite(t)?t:0}function h(t,e,n){return new i.Coordinate(a(e/t),a(n/t))}function c(t,e,i,n,s){return t-e>0?i:t-e<0?n:s}function d(t,e){return Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?c(t.x,e.x,p.Direction.LEFT,p.Direction.RIGHT,p.Direction.NONE):c(t.y,e.y,p.Direction.UP,p.Direction.DOWN,p.Direction.NONE)}function u(t,e){var i=n(t)&&(e===p.Direction.LEFT||e===p.Direction.RIGHT),a=s(t)&&(e===p.Direction.UP||e===p.Direction.DOWN),h=o(t)&&r(e);return i||a||h}function v(t,e,i,a){return n(t)&&Math.abs(i)>0||s(t)&&Math.abs(a)>0||o(t)&&r(e)}function l(t,e,i){var o=Object.assign({},e),r=Object.assign({},i);return n(t)?(o.y=0,r.y=0):s(t)&&(o.x=0,r.x=0),d(o,r)}t=t&&t.hasOwnProperty("default")?t.default:t;var p={EventType:{START:"odopointer:start",MOVE:"odopointer:move",END:"odopointer:end"},Direction:{RIGHT:"right",LEFT:"left",UP:"up",DOWN:"down",NONE:"no_movement"},TouchActionSupport:{x:(e=e&&e.hasOwnProperty("default")?e.default:e).prefixed("touchAction","pan-y"),y:e.prefixed("touchAction","pan-x"),xy:e.prefixed("touchAction","none")},TouchAction:{x:"pan-y",y:"pan-x",xy:"none"},Axis:{X:"x",Y:"y",BOTH:"xy"},Defaults:{axis:"xy",preventEventDefault:!0},MAX_VELOCITY:12,VELOCITY_INTERVAL:100,SWIPE_VELOCITY:.6,LOCK_THRESHOLD:6,DRAG_THRESHOLD:5},_=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},E=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),f=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},T=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},y=function(){function t(e){_(this,t),this.type=e.type,this.target=e.target,this.currentTarget=e.currentTarget,this.start=e.start,this.end=e.end,this.delta=e.delta,this.deltaTime=e.deltaTime,this.velocity=h(this.deltaTime,this.delta.x,this.delta.y),this.currentVelocity=e.currentVelocity,this.distance=i.Coordinate.distance(e.start,e.end),this.direction=d(e.start,e.end),this.isDirectionOnAxis=u(e.axis,this.direction),this.didMoveOnAxis=v(e.axis,this.direction,this.delta.x,this.delta.y),this.axisDirection=l(e.axis,e.start,e.end),this.position=e.position,this.defaultPrevented=!1}return t.prototype.preventDefault=function(){this.defaultPrevented=!0},t}(),D=function(t){function n(s){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_(this,n);var r=T(this,t.call(this));if(!s||1!==s.nodeType)throw new TypeError("OdoPointer requires an element.");var a=Object.assign({},n.Defaults,o);r._shouldPreventDefault=a.preventEventDefault,r._el=s,r.pageStart=new i.Coordinate,r.page=new i.Coordinate,r.delta=new i.Coordinate,r._lastPosition=new i.Coordinate,r._friction=1,r.axis=a.axis,r.hasDragged=!1,r._isLocked=!1,r._isDeactivated=!1,r._enabled=!0,r._velocityTrackerId=null,r.startTime=0,r.deltaTime=0,r._lastTime=0,r.velocity=new i.Coordinate,r._hasTrackedVelocity=!1,r.dragEventTarget=document;var h=n.TouchActionSupport[r.axis];return r._isTouchActionSupported=!!h,r._shouldPreventDefault&&r._isTouchActionSupported?r.element.style[h]=n.TouchAction[r.axis]:r._shouldPreventDefault&&e.HAS_TOUCH_EVENTS&&window.addEventListener(i.events.TOUCHMOVE,i.utilities.noop),r.listen(),r}return f(n,t),n.prototype.listen=function(){this._onStart=this._handleDragStart.bind(this),e.HAS_POINTER_EVENTS?this._el.addEventListener(i.events.POINTERDOWN,this._onStart):(this._el.addEventListener(i.events.MOUSEDOWN,this._onStart),e.HAS_TOUCH_EVENTS&&this._el.addEventListener(i.events.TOUCHSTART,this._onStart)),this._el.addEventListener(i.events.DRAGSTART,n._preventDefault)},n.prototype.isXAxis=function(){return this.axis===n.Axis.X},n.prototype.isYAxis=function(){return this.axis===n.Axis.Y},n.prototype.isBothAxis=function(){return this.axis===n.Axis.BOTH},n.prototype.applyFriction=function(t){return t.scale(this.friction)},n.prototype._canStartDrag=function(t){return this.isEnabled&&(n.isTouchEvent(t)||0===t.button)},n.prototype._canContinueDrag=function(){return this.isEnabled&&!this._isDeactivated},n.prototype._handleDragStart=function(t){clearInterval(this._velocityTrackerId),this._canStartDrag(t)&&(this._setDragStartValues(n._getPageCoordinate(t)),this._emitEvent(this._createEvent(n.EventType.START,t))||(this._addDragHandlers(t.type),this._velocityTrackerId=setInterval(this._trackVelocity.bind(this),n.VELOCITY_INTERVAL)))},n.prototype._handleDragMove=function(t){this._canContinueDrag()&&(this._setDragMoveValues(n._getPageCoordinate(t)),this._emitEvent(this._createEvent(n.EventType.MOVE,t))||!this._shouldPreventDefault||this._isTouchActionSupported||this._finishDragMove(t))},n.prototype._finishDragMove=function(t){this._maybeLock(),this._maybeDeactivate(),this._isLocked&&t.preventDefault(),this._isDeactivated&&(clearInterval(this._velocityTrackerId),this.velocity.x=0,this.velocity.y=0)},n.prototype._handleDragEnd=function(t){clearInterval(this._velocityTrackerId),this.deltaTime=Date.now()-this.startTime,this._hasTrackedVelocity||this._trackVelocity(),this._removeDragHandlers();var e=this._createEvent(n.EventType.END,t);e.isCancelEvent=n._isCancelEvent(t),this._emitEvent(e)&&t.preventDefault(),this.hasDragged=!1,this._isDeactivated=!1,this._isLocked=!1},n.prototype._setDragStartValues=function(t){this.pageStart=t,this.page=t,this._lastPosition=t,this.delta=new i.Coordinate,this.velocity=new i.Coordinate,this._hasTrackedVelocity=!1,this.startTime=Date.now(),this._lastTime=Date.now(),this.deltaTime=0},n.prototype._setDragMoveValues=function(t){var e=i.Coordinate.difference(t,this.page);this.applyFriction(e),this.delta.translate(e),this.page=t,this.deltaTime=Date.now()-this.startTime,this.hasDragged=!0},n.prototype._maybeLock=function(){this._isLocked||(this._isLocked=this._shouldLock(this.delta))},n.prototype._maybeDeactivate=function(){this._isDeactivated||(this._isDeactivated=this._shouldDeactivate(this.delta))},n.prototype._shouldLock=function(t){var e=this.isXAxis()&&Math.abs(t.x)>n.LOCK_THRESHOLD,i=this.isYAxis()&&Math.abs(t.y)>n.LOCK_THRESHOLD;return this.isBothAxis()||e||i},n.prototype._shouldDeactivate=function(t){var e=this.isXAxis()&&Math.abs(t.y)>n.DRAG_THRESHOLD,i=this.isYAxis()&&Math.abs(t.x)>n.DRAG_THRESHOLD;return!this._isLocked&&(this.isBothAxis()||e||i)},n.prototype._createEvent=function(t,e){return new n.Event({type:t,pointerId:this.id,currentTarget:this.element,target:e.target,axis:this.axis,deltaTime:this.deltaTime,delta:this.delta,start:this.pageStart,end:this.page,currentVelocity:this.velocity})},n.prototype._addDragHandlers=function(t){var e=this.dragEventTarget;switch(this._onMove=this._handleDragMove.bind(this),this._onEnd=this._handleDragEnd.bind(this),t){case i.events.POINTERDOWN:e.addEventListener(i.events.POINTERMOVE,this._onMove),e.addEventListener(i.events.POINTERUP,this._onEnd),e.addEventListener(i.events.POINTERCANCEL,this._onEnd);break;case i.events.MOUSEDOWN:e.addEventListener(i.events.MOUSEMOVE,this._onMove),e.addEventListener(i.events.MOUSEUP,this._onEnd);break;case i.events.TOUCHSTART:e.addEventListener(i.events.TOUCHMOVE,this._onMove),e.addEventListener(i.events.TOUCHEND,this._onEnd),e.addEventListener(i.events.TOUCHCANCEL,this._onEnd)}},n.prototype._removeDragHandlers=function(){var t=this.dragEventTarget;t.removeEventListener(i.events.POINTERMOVE,this._onMove),t.removeEventListener(i.events.POINTERUP,this._onEnd),t.removeEventListener(i.events.POINTERCANCEL,this._onEnd),t.removeEventListener(i.events.MOUSEMOVE,this._onMove),t.removeEventListener(i.events.MOUSEUP,this._onEnd),t.removeEventListener(i.events.TOUCHMOVE,this._onMove),t.removeEventListener(i.events.TOUCHEND,this._onEnd),t.removeEventListener(i.events.TOUCHCANCEL,this._onEnd)},n.prototype._trackVelocity=function(){var t=Date.now(),e=t-this._lastTime,s=i.Coordinate.difference(this.page,this._lastPosition);this.applyFriction(s),this._lastTime=t,this._lastPosition=this.page;var o=n.MAX_VELOCITY;this.velocity.x=i.math.clamp(s.x/e,-o,o),this.velocity.y=i.math.clamp(s.y/e,-o,o),this._hasTrackedVelocity=!0},n.prototype.hasVelocity=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.SWIPE_VELOCITY;return this.isYAxis()?Math.abs(t.y)>e:this.isXAxis()?Math.abs(t.x)>e:Math.abs(t.x)>e||Math.abs(t.y)>e},n.prototype._emitEvent=function(t){return this.emit(t.type,t),t.defaultPrevented},n.prototype.dispose=function(){clearInterval(this._velocityTrackerId),this._removeDragHandlers(),this._el.removeEventListener(i.events.POINTERDOWN,this._onStart),this._el.removeEventListener(i.events.MOUSEDOWN,this._onStart),this._el.removeEventListener(i.events.TOUCHSTART,this._onStart),this._isTouchActionSupported?this._el.style[n.TouchActionSupport[this.axis]]="":this._shouldPreventDefault&&e.HAS_TOUCH_EVENTS&&window.removeEventListener(i.events.TOUCHMOVE,i.utilities.noop),this._el=null,this.dragEventTarget=null},n.isTouchEvent=function(t){return!!t.changedTouches},n._isCancelEvent=function(t){return t.type===i.events.POINTERCANCEL||t.type===i.events.TOUCHCANCEL},n._getPageCoordinate=function(t){var e=void 0;return e=n.isTouchEvent(t)?t.changedTouches[0]:t,new i.Coordinate(e.pageX,e.pageY)},n._preventDefault=function(t){t.preventDefault()},E(n,[{key:"element",get:function(){return this._el}},{key:"isEnabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"friction",get:function(){return this._friction},set:function(t){this._friction=t}}]),n}(t);return Object.assign(D,p),D.Event=y,D}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("tiny-emitter"),require("@odopod/odo-device"),require("@odopod/odo-helpers")):"function"==typeof define&&define.amd?define(["tiny-emitter","@odopod/odo-device","@odopod/odo-helpers"],e):t.OdoPointer=e(t.TinyEmitter,t.OdoDevice,t.OdoHelpers)}(this,function(t,e,i){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n={EventType:{START:"odopointer:start",MOVE:"odopointer:move",END:"odopointer:end"},Direction:{RIGHT:"right",LEFT:"left",UP:"up",DOWN:"down",NONE:"no_movement"},TouchActionSupport:{x:(e=e&&e.hasOwnProperty("default")?e.default:e).prefixed("touchAction","pan-y"),y:e.prefixed("touchAction","pan-x"),xy:e.prefixed("touchAction","none")},TouchAction:{x:"pan-y",y:"pan-x",xy:"none"},Axis:{X:"x",Y:"y",BOTH:"xy"},Defaults:{axis:"xy",preventEventDefault:!0},MAX_VELOCITY:12,VELOCITY_INTERVAL:100,SWIPE_VELOCITY:.6,LOCK_THRESHOLD:6,DRAG_THRESHOLD:5},s=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};function a(t){return t===n.Axis.X}function h(t){return t===n.Axis.Y}function c(t){return t===n.Axis.BOTH}function d(t){return t!==n.Direction.NONE}function u(t){return Number.isFinite(t)?t:0}function v(t,e,i,n,s){return t-e>0?i:t-e<0?n:s}function l(t,e){return Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?v(t.x,e.x,n.Direction.LEFT,n.Direction.RIGHT,n.Direction.NONE):v(t.y,e.y,n.Direction.UP,n.Direction.DOWN,n.Direction.NONE)}var p=function(){function t(e){var o,r,v,p,_,E,T,y,f,D,O,g,x,m,L,C,A;s(this,t),this.type=e.type,this.target=e.target,this.currentTarget=e.currentTarget,this.start=e.start,this.end=e.end,this.delta=e.delta,this.deltaTime=e.deltaTime,this.velocity=(o=this.deltaTime,r=this.delta.x,v=this.delta.y,new i.Coordinate(u(r/o),u(v/o))),this.currentVelocity=e.currentVelocity,this.distance=i.Coordinate.distance(e.start,e.end),this.direction=l(e.start,e.end),this.isDirectionOnAxis=(p=e.axis,_=this.direction,E=a(p)&&(_===n.Direction.LEFT||_===n.Direction.RIGHT),T=h(p)&&(_===n.Direction.UP||_===n.Direction.DOWN),y=c(p)&&d(_),E||T||y),this.didMoveOnAxis=(f=e.axis,D=this.direction,O=this.delta.x,g=this.delta.y,a(f)&&Math.abs(O)>0||h(f)&&Math.abs(g)>0||c(f)&&d(D)),this.axisDirection=(x=e.axis,m=e.start,L=e.end,C=Object.assign({},m),A=Object.assign({},L),a(x)?(C.y=0,A.y=0):h(x)&&(C.x=0,A.x=0),l(C,A)),this.position=e.position,this.defaultPrevented=!1}return t.prototype.preventDefault=function(){this.defaultPrevented=!0},t}(),_=function(t){function n(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n);var h=r(this,t.call(this));if(!o||1!==o.nodeType)throw new TypeError("OdoPointer requires an element.");var c=Object.assign({},n.Defaults,a);h._shouldPreventDefault=c.preventEventDefault,h._el=o,h.pageStart=new i.Coordinate,h.page=new i.Coordinate,h.delta=new i.Coordinate,h._lastPosition=new i.Coordinate,h._friction=1,h.axis=c.axis,h.hasDragged=!1,h._isLocked=!1,h._isDeactivated=!1,h._enabled=!0,h._velocityTrackerId=null,h.startTime=0,h.deltaTime=0,h._lastTime=0,h.velocity=new i.Coordinate,h._hasTrackedVelocity=!1,h.dragEventTarget=document;var d=n.TouchActionSupport[h.axis];return h._isTouchActionSupported=!!d,h._shouldPreventDefault&&h._isTouchActionSupported?h.element.style[d]=n.TouchAction[h.axis]:h._shouldPreventDefault&&e.HAS_TOUCH_EVENTS&&window.addEventListener(i.events.TOUCHMOVE,i.utilities.noop),h.listen(),h}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,t),n.prototype.listen=function(){this._onStart=this._handleDragStart.bind(this),e.HAS_POINTER_EVENTS?this._el.addEventListener(i.events.POINTERDOWN,this._onStart):(this._el.addEventListener(i.events.MOUSEDOWN,this._onStart),e.HAS_TOUCH_EVENTS&&this._el.addEventListener(i.events.TOUCHSTART,this._onStart)),this._el.addEventListener(i.events.DRAGSTART,n._preventDefault)},n.prototype.isXAxis=function(){return this.axis===n.Axis.X},n.prototype.isYAxis=function(){return this.axis===n.Axis.Y},n.prototype.isBothAxis=function(){return this.axis===n.Axis.BOTH},n.prototype.applyFriction=function(t){return t.scale(this.friction)},n.prototype._canStartDrag=function(t){return this.isEnabled&&(n.isTouchEvent(t)||0===t.button)},n.prototype._canContinueDrag=function(){return this.isEnabled&&!this._isDeactivated},n.prototype._handleDragStart=function(t){(clearInterval(this._velocityTrackerId),this._canStartDrag(t))&&(this._setDragStartValues(n._getPageCoordinate(t)),this._emitEvent(this._createEvent(n.EventType.START,t))||(this._addDragHandlers(t.type),this._velocityTrackerId=setInterval(this._trackVelocity.bind(this),n.VELOCITY_INTERVAL)))},n.prototype._handleDragMove=function(t){this._canContinueDrag()&&(this._setDragMoveValues(n._getPageCoordinate(t)),this._emitEvent(this._createEvent(n.EventType.MOVE,t))||!this._shouldPreventDefault||this._isTouchActionSupported||this._finishDragMove(t))},n.prototype._finishDragMove=function(t){this._maybeLock(),this._maybeDeactivate(),this._isLocked&&t.preventDefault(),this._isDeactivated&&(clearInterval(this._velocityTrackerId),this.velocity.x=0,this.velocity.y=0)},n.prototype._handleDragEnd=function(t){clearInterval(this._velocityTrackerId),this.deltaTime=Date.now()-this.startTime,this._hasTrackedVelocity||this._trackVelocity(),this._removeDragHandlers();var e=this._createEvent(n.EventType.END,t);e.isCancelEvent=n._isCancelEvent(t),this._emitEvent(e)&&t.preventDefault(),this.hasDragged=!1,this._isDeactivated=!1,this._isLocked=!1},n.prototype._setDragStartValues=function(t){this.pageStart=t,this.page=t,this._lastPosition=t,this.delta=new i.Coordinate,this.velocity=new i.Coordinate,this._hasTrackedVelocity=!1,this.startTime=Date.now(),this._lastTime=Date.now(),this.deltaTime=0},n.prototype._setDragMoveValues=function(t){var e=i.Coordinate.difference(t,this.page);this.applyFriction(e),this.delta.translate(e),this.page=t,this.deltaTime=Date.now()-this.startTime,this.hasDragged=!0},n.prototype._maybeLock=function(){this._isLocked||(this._isLocked=this._shouldLock(this.delta))},n.prototype._maybeDeactivate=function(){this._isDeactivated||(this._isDeactivated=this._shouldDeactivate(this.delta))},n.prototype._shouldLock=function(t){var e=this.isXAxis()&&Math.abs(t.x)>n.LOCK_THRESHOLD,i=this.isYAxis()&&Math.abs(t.y)>n.LOCK_THRESHOLD;return this.isBothAxis()||e||i},n.prototype._shouldDeactivate=function(t){var e=this.isXAxis()&&Math.abs(t.y)>n.DRAG_THRESHOLD,i=this.isYAxis()&&Math.abs(t.x)>n.DRAG_THRESHOLD;return!this._isLocked&&(this.isBothAxis()||e||i)},n.prototype._createEvent=function(t,e){return new n.Event({type:t,pointerId:this.id,currentTarget:this.element,target:e.target,axis:this.axis,deltaTime:this.deltaTime,delta:this.delta,start:this.pageStart,end:this.page,currentVelocity:this.velocity})},n.prototype._addDragHandlers=function(t){var e=this.dragEventTarget;switch(this._onMove=this._handleDragMove.bind(this),this._onEnd=this._handleDragEnd.bind(this),t){case i.events.POINTERDOWN:e.addEventListener(i.events.POINTERMOVE,this._onMove),e.addEventListener(i.events.POINTERUP,this._onEnd),e.addEventListener(i.events.POINTERCANCEL,this._onEnd);break;case i.events.MOUSEDOWN:e.addEventListener(i.events.MOUSEMOVE,this._onMove),e.addEventListener(i.events.MOUSEUP,this._onEnd);break;case i.events.TOUCHSTART:e.addEventListener(i.events.TOUCHMOVE,this._onMove),e.addEventListener(i.events.TOUCHEND,this._onEnd),e.addEventListener(i.events.TOUCHCANCEL,this._onEnd)}},n.prototype._removeDragHandlers=function(){var t=this.dragEventTarget;t.removeEventListener(i.events.POINTERMOVE,this._onMove),t.removeEventListener(i.events.POINTERUP,this._onEnd),t.removeEventListener(i.events.POINTERCANCEL,this._onEnd),t.removeEventListener(i.events.MOUSEMOVE,this._onMove),t.removeEventListener(i.events.MOUSEUP,this._onEnd),t.removeEventListener(i.events.TOUCHMOVE,this._onMove),t.removeEventListener(i.events.TOUCHEND,this._onEnd),t.removeEventListener(i.events.TOUCHCANCEL,this._onEnd)},n.prototype._trackVelocity=function(){var t=Date.now(),e=t-this._lastTime,s=i.Coordinate.difference(this.page,this._lastPosition);this.applyFriction(s),this._lastTime=t,this._lastPosition=this.page;var o=n.MAX_VELOCITY;this.velocity.x=i.math.clamp(s.x/e,-o,o),this.velocity.y=i.math.clamp(s.y/e,-o,o),this._hasTrackedVelocity=!0},n.prototype.hasVelocity=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.SWIPE_VELOCITY;return this.isYAxis()?Math.abs(t.y)>e:this.isXAxis()?Math.abs(t.x)>e:Math.abs(t.x)>e||Math.abs(t.y)>e},n.prototype._emitEvent=function(t){return this.emit(t.type,t),t.defaultPrevented},n.prototype.dispose=function(){clearInterval(this._velocityTrackerId),this._removeDragHandlers(),this._el.removeEventListener(i.events.POINTERDOWN,this._onStart),this._el.removeEventListener(i.events.MOUSEDOWN,this._onStart),this._el.removeEventListener(i.events.TOUCHSTART,this._onStart),this._isTouchActionSupported?this._el.style[n.TouchActionSupport[this.axis]]="":this._shouldPreventDefault&&e.HAS_TOUCH_EVENTS&&window.removeEventListener(i.events.TOUCHMOVE,i.utilities.noop),this._el=null,this.dragEventTarget=null},n.isTouchEvent=function(t){return!!t.changedTouches},n._isCancelEvent=function(t){return t.type===i.events.POINTERCANCEL||t.type===i.events.TOUCHCANCEL},n._getPageCoordinate=function(t){var e=void 0;return e=n.isTouchEvent(t)?t.changedTouches[0]:t,new i.Coordinate(e.pageX,e.pageY)},n._preventDefault=function(t){t.preventDefault()},o(n,[{key:"element",get:function(){return this._el}},{key:"isEnabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"friction",get:function(){return this._friction},set:function(t){this._friction=t}}]),n}(t);return Object.assign(_,n),_.Event=p,_}); | ||
//# sourceMappingURL=odo-pointer.min.js.map |
{ | ||
"name": "@odopod/odo-pointer", | ||
"description": "An abstraction for pointer, mouse, and touch events.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "dist/odo-pointer.js", | ||
@@ -15,4 +15,4 @@ "odoModule": "src/pointer.js", | ||
"dependencies": { | ||
"@odopod/odo-device": "^1.0.2", | ||
"@odopod/odo-helpers": "^1.0.2", | ||
"@odopod/odo-device": "^1.0.3", | ||
"@odopod/odo-helpers": "^1.0.3", | ||
"tiny-emitter": "^2.0.1" | ||
@@ -40,3 +40,3 @@ }, | ||
"license": "MIT", | ||
"repository": "odopod/odo", | ||
"repository": "odopod/code-library", | ||
"scripts": { | ||
@@ -43,0 +43,0 @@ "test": "gulp code-quality test" |
@@ -23,2 +23,2 @@ # Odo Pointer | ||
[permalink]: https://code.odopod.com/odo-pointer/ | ||
[permalink]: http://code.odopod.com/odo-pointer/ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
144564
Updated@odopod/odo-device@^1.0.3
Updated@odopod/odo-helpers@^1.0.3