@egjs/hammerjs
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -1,2 +0,2 @@ | ||
/*! Hammer.JS - v2.0.11 - 2018-10-10 | ||
/*! Hammer.JS - v2.0.12 - 2018-10-23 | ||
* http://naver.github.io/egjs | ||
@@ -7,3 +7,3 @@ * | ||
* Licensed under the MIT license */ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Hammer=e()}(this,function(){"use strict";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function o(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var a="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign,u=["","webkit","Moz","MS","ms","o"],t=document.createElement("div"),n="function",c=Math.round,w=Math.abs,b=Date.now;function h(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<u.length;){if((i=(n=u[o])?n+r:e)in t)return i;o++}}var l=h(t.style,"touchAction"),p=void 0!==l;var f="compute",v="auto",d="manipulation",m="none",g="pan-x",y="pan-y",T=function(){if(!p)return!1;var e={},n=window.CSS&&window.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!n||window.CSS.supports("touch-action",t)}),e}(),E="ontouchstart"in window,I=void 0!==h(window,"PointerEvent"),A=E&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),P="touch",S="mouse",C=25,_=1,D=4,O=8,x=1,R=2,M=4,z=8,N=16,X=R|M,Y=z|N,F=X|Y,q=["x","y"],W=["clientX","clientY"];function L(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function k(t,e){return typeof t===n?t.apply(e&&e[0]||void 0,e):t}function j(t,e){return-1<t.indexOf(e)}var H=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===f&&(t=this.compute()),p&&this.manager.element.style&&T[t]&&(this.manager.element.style[l]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return L(this.manager.recognizers,function(t){k(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(j(t,m))return m;var e=j(t,g),n=j(t,y);return e&&n?m:e||n?e?g:y:j(t,d)?d:v}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=j(i,m)&&!T[m],o=j(i,y)&&!T[y],s=j(i,g)&&!T[g];if(r){var a=1===t.pointers.length,u=t.distance<2,c=t.deltaTime<250;if(a&&u&&c)return}if(!s||!o)return r||o&&n&X||s&&n&Y?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function U(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function V(t){var e=t.length;if(1===e)return{x:c(t[0].clientX),y:c(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:c(n/e),y:c(i/e)}}function G(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:c(t.pointers[n].clientX),clientY:c(t.pointers[n].clientY)},n++;return{timeStamp:b(),pointers:e,center:V(e),deltaX:t.deltaX,deltaY:t.deltaY}}function Z(t,e,n){n||(n=q);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function B(t,e,n){n||(n=q);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function $(t,e){return t===e?x:w(t)>=w(e)?t<0?R:M:e<0?z:N}function J(t,e,n){return{x:e/t||0,y:n/t||0}}function K(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=G(e)),1<r&&!n.firstMultiple?n.firstMultiple=G(e):1===r&&(n.firstMultiple=!1);var o,s,a,u,c,h,l=n.firstInput,p=n.firstMultiple,f=p?p.center:l.center,v=e.center=V(i);e.timeStamp=b(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=B(f,v),e.distance=Z(f,v),o=n,a=(s=e).center,u=o.offsetDelta||{},c=o.prevDelta||{},h=o.prevInput||{},s.eventType!==_&&h.eventType!==D||(c=o.prevDelta={x:h.deltaX||0,y:h.deltaY||0},u=o.offsetDelta={x:a.x,y:a.y}),s.deltaX=c.x+(a.x-u.x),s.deltaY=c.y+(a.y-u.y),e.offsetDirection=$(e.deltaX,e.deltaY);var d,m,g,y,T=J(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=T.x,e.overallVelocityY=T.y,e.overallVelocity=w(T.x)>w(T.y)?T.x:T.y,e.scale=p?(d=p.pointers,Z((m=i)[0],m[1],W)/Z(d[0],d[1],W)):1,e.rotation=p?(g=p.pointers,B((y=i)[1],y[0],W)+B(g[1],g[0],W)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==O&&(C<a||void 0===s.velocity)){var u=e.deltaX-s.deltaX,c=e.deltaY-s.deltaY,h=J(a,u,c);i=h.x,r=h.y,n=w(h.x)>w(h.y)?h.x:h.y,o=$(u,c),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}(n,e);var E=t.element;U(e.srcEvent.target,E)&&(E=e.srcEvent.target),e.target=E}function Q(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&_&&i-r==0,s=e&(D|O)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,K(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function tt(t){return t.trim().split(/\s+/g)}function et(e,t,n){L(tt(t),function(t){e.addEventListener(t,n,!1)})}function nt(e,t,n){L(tt(t),function(t){e.removeEventListener(t,n,!1)})}function it(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var e=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){k(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&et(this.element,this.evEl,this.domHandler),this.evTarget&&et(this.target,this.evTarget,this.domHandler),this.evWin&&et(it(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&nt(this.element,this.evEl,this.domHandler),this.evTarget&&nt(this.target,this.evTarget,this.domHandler),this.evWin&&nt(it(this.element),this.evWin,this.domHandler)},t}();function rt(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}var ot={pointerdown:_,pointermove:2,pointerup:D,pointercancel:O,pointerout:O},st={2:P,3:"pen",4:S,5:"kinect"},at="pointerdown",ut="pointermove pointerup pointercancel";window.MSPointerEvent&&!window.PointerEvent&&(at="MSPointerDown",ut="MSPointerMove MSPointerUp MSPointerCancel");var ct=function(n){function i(){var t,e=i.prototype;return e.evEl=at,e.evWin=ut,(t=n.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return o(i,n),i.prototype.handler=function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=ot[i],o=st[t.pointerType]||t.pointerType,s=o===P,a=rt(e,t.pointerId,"pointerId");r&_&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(D|O)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))},i}(e);function ht(t){return Array.prototype.slice.call(t,0)}function lt(t,n,e){for(var i=[],r=[],o=0;o<t.length;){var s=n?t[o][n]:t[o];rt(r,s)<0&&i.push(t[o]),r[o]=s,o++}return e&&(i=n?i.sort(function(t,e){return t[n]>e[n]}):i.sort()),i}var pt={touchstart:_,touchmove:2,touchend:D,touchcancel:O},ft=function(t){function e(){return e.prototype.evTarget="touchstart touchmove touchend touchcancel",e.prototype.targetIds={},t.apply(this,arguments)||this}return o(e,t),e.prototype.handler=function(t){var e=pt[t.type],n=function(t,e){var n,i,r=ht(t.touches),o=this.targetIds;if(e&(2|_)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=ht(t.changedTouches),a=[],u=this.target;if(i=r.filter(function(t){return U(t.target,u)}),e===_)for(n=0;n<i.length;)o[i[n].identifier]=!0,n++;n=0;for(;n<s.length;)o[s[n].identifier]&&a.push(s[n]),e&(D|O)&&delete o[s[n].identifier],n++;return a.length?[lt(i.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:P,srcEvent:t})},e}(e);var vt={mousedown:_,mousemove:2,mouseup:D},dt=function(n){function i(){var t,e=i.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=n.apply(this,arguments)||this).pressed=!1,t}return o(i,n),i.prototype.handler=function(t){var e=vt[t.type];e&_&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=D),this.pressed&&(e&D&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:S,srcEvent:t}))},i}(e),mt=2500,gt=25;function yt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY},i=this.lastTouches;this.lastTouches.push(n);setTimeout(function(){var t=i.indexOf(n);-1<t&&i.splice(t,1)},mt)}}var Tt=function(){return function(n){function t(t,e){var o;return i(s(s(o=n.call(this,t,e)||this)),"handler",function(t,e,n){var i=n.pointerType===P,r=n.pointerType===S;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(t,e){t&_?(this.primaryTouch=e.changedPointers[0].identifier,yt.call(this,e)):t&(D|O)&&yt.call(this,e)}).call(s(s(o)),e,n);else if(r&&function(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=gt&&s<=gt)return!0}return!1}.call(s(s(o)),n))return;o.callback(t,e,n)}}),o.touch=new ft(o.manager,o.handler),o.mouse=new dt(o.manager,o.handler),o.primaryTouch=null,o.lastTouches=[],o}return o(t,n),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(e)}();function Et(t,e,n){return!!Array.isArray(t)&&(L(t,n[e],n),!0)}var wt=1;function bt(t,e){var n=e.manager;return n?n.get(t):t}function It(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var At=function(){function t(t){void 0===t&&(t={}),this.options=r({enable:!0},t),this.id=wt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return a(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(Et(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=bt(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return Et(t,"dropRecognizeWith",this)||(t=bt(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(Et(t,"requireFailure",this))return this;var e=this.requireFail;return-1===rt(e,t=bt(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(Et(t,"dropRequireFailure",this))return this;t=bt(t,this);var e=rt(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var n=this,t=this.state;function i(t){n.manager.emit(t,e)}t<8&&i(n.options.event+It(t)),i(n.options.event),e.additionalEvent&&i(e.additionalEvent),8<=t&&i(n.options.event+It(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=a({},t);if(!k(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),Pt={domEvents:!1,touchAction:f,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function St(n,i){var r,o=n.element;o.style&&(L(n.options.cssProps,function(t,e){r=h(o.style,e),o.style[r]=i?(n.oldCssProps[r]=o.style[r],t):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var Ct=function(){function t(t,e){var n,i=this;this.options=a({},Pt,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(I?ct:A?ft:E?Tt:dt))(n,Q),this.touchAction=new H(this,this.options.touchAction),St(this,!0),L(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return a(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!==r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),o++}},e.get=function(t){if(t instanceof At)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event===t)return e[n];return null},e.add=function(t){if(Et(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(Et(t,"remove",this))return this;var e=this.get(t);if(t){var n=this.recognizers,i=rt(n,e);-1!==i&&(n.splice(i,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var n=this.handlers;return L(tt(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var n=this.handlers;return L(tt(t),function(t){e?n[t]&&n[t].splice(rt(n[t],e),1):delete n[t]}),this},e.emit=function(t,e){var n,i,r;this.options.domEvents&&(n=t,i=e,(r=document.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var o=this.handlers[t]&&this.handlers[t].slice();if(o&&o.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var s=0;s<o.length;)o[s](e),s++}},e.destroy=function(){this.element&&St(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}(),_t=function(e){function t(t){return void 0===t&&(t={}),e.call(this,r({pointers:1},t))||this}o(t,e);var n=t.prototype;return n.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},n.process=function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&O||!r)?16|e:i||r?n&D?8|e:2&e?4|e:2:32},t}(At),Dt=function(e){function t(t){return void 0===t&&(t={}),e.call(this,r({event:"rotate",threshold:0,pointers:2},t))||this}o(t,e);var n=t.prototype;return n.getTouchAction=function(){return[m]},n.attrTest=function(t){return e.prototype.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)},t}(_t),Ot=function(n){function t(t){return void 0===t&&(t={}),n.call(this,r({event:"pinch",threshold:0,pointers:2},t))||this}o(t,n);var e=t.prototype;return e.getTouchAction=function(){return[m]},e.attrTest=function(t){return n.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}n.prototype.emit.call(this,t)},t}(_t);function xt(t){return t===N?"down":t===z?"up":t===R?"left":t===M?"right":""}var Rt=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,r({event:"pan",threshold:10,pointers:1,direction:F},t))||this).pX=null,e.pY=null,e}o(t,n);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&X&&e.push(y),t&Y&&e.push(g),e},e.directionTest=function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(i=e.direction&X?(r=0===o?x:o<0?R:M,n=o!==this.pX,Math.abs(t.deltaX)):(r=0===s?x:s<0?z:N,n=s!==this.pY,Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},e.attrTest=function(t){return _t.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=xt(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}(_t),Mt=function(i){function t(t){return void 0===t&&(t={}),i.call(this,r({event:"swipe",threshold:10,velocity:.3,direction:X|Y,pointers:1},t))||this}o(t,i);var e=t.prototype;return e.getTouchAction=function(){return Rt.prototype.getTouchAction.call(this)},e.attrTest=function(t){var e,n=this.options.direction;return n&(X|Y)?e=t.overallVelocity:n&X?e=t.overallVelocityX:n&Y&&(e=t.overallVelocityY),i.prototype.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers===this.options.pointers&&w(e)>this.options.velocity&&t.eventType&D},e.emit=function(t){var e=xt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)},t}(_t),zt=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,r({event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},t))||this).pTime=!1,e.pCenter=!1,e._timer=null,e._input=null,e.count=0,e}o(t,n);var e=t.prototype;return e.getTouchAction=function(){return[d]},e.process=function(t){var e=this,n=this.options,i=t.pointers.length===n.pointers,r=t.distance<n.threshold,o=t.deltaTime<n.time;if(this.reset(),t.eventType&_&&0===this.count)return this.failTimeout();if(r&&o&&i){if(t.eventType!==D)return this.failTimeout();var s=!this.pTime||t.timeStamp-this.pTime<n.interval,a=!this.pCenter||Z(this.pCenter,t.center)<n.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,a&&s?this.count+=1:this.count=1,this._input=t,0===this.count%n.taps)return this.hasRequireFailures()?(this._timer=setTimeout(function(){e.state=8,e.tryEmit()},n.interval),2):8}return 32},e.failTimeout=function(){var t=this;return this._timer=setTimeout(function(){t.state=32},this.options.interval),32},e.reset=function(){clearTimeout(this._timer)},e.emit=function(){8===this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))},t}(At),Nt=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,r({event:"press",pointers:1,time:251,threshold:9},t))||this)._timer=null,e._input=null,e}o(t,n);var e=t.prototype;return e.getTouchAction=function(){return[v]},e.process=function(t){var e=this,n=this.options,i=t.pointers.length===n.pointers,r=t.distance<n.threshold,o=t.deltaTime>n.time;if(this._input=t,!r||!i||t.eventType&(D|O)&&!o)this.reset();else if(t.eventType&_)this.reset(),this._timer=setTimeout(function(){e.state=8,e.tryEmit()},n.time);else if(t.eventType&D)return 8;return 32},e.reset=function(){clearTimeout(this._timer)},e.emit=function(t){8===this.state&&(t&&t.eventType&D?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=b(),this.manager.emit(this.options.event,this._input)))},t}(At),Xt=function(){var t=function(t,e){return void 0===e&&(e={}),new Ct(t,r({recognizers:[[Dt,{enable:!1}],[Ot,{enable:!1},["rotate"]],[Mt,{direction:X}],[Rt,{direction:X},["swipe"]],[zt],[zt,{event:"doubletap",taps:2},["tap"]],[Nt]]},e))};return i(t,"VERSION","2.0.11"),t}(),Yt={touchstart:_,touchmove:2,touchend:D,touchcancel:O},Ft=function(n){function i(){var t,e=i.prototype;return e.evTarget="touchstart",e.evWin="touchstart touchmove touchend touchcancel",(t=n.apply(this,arguments)||this).started=!1,t}return o(i,n),i.prototype.handler=function(t){var e=Yt[t.type];if(e===_&&(this.started=!0),this.started){var n=function(t,e){var n=ht(t.touches),i=ht(t.changedTouches);e&(D|O)&&(n=lt(n.concat(i),"identifier",!0));return[n,i]}.call(this,t,e);e&(D|O)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:P,srcEvent:t})}},i}(e);function qt(i,t,e){var r="DEPRECATED METHOD: "+t+"\n"+e+" AT \n";return function(){var t=new Error("get-stack-trace"),e=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=window.console&&(window.console.warn||window.console.log);return n&&n.call(window.console,r,e),i.apply(this,arguments)}}var Wt=qt(function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&void 0===t[i[r]])&&(t[i[r]]=e[i[r]]),r++;return t},"extend","Use `assign`."),Lt=qt(function(t,e){return Wt(t,e,!0)},"merge","Use `assign`.");var kt={default:Xt,INPUT_START:_,INPUT_MOVE:2,INPUT_END:D,INPUT_CANCEL:O,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:x,DIRECTION_LEFT:R,DIRECTION_RIGHT:M,DIRECTION_UP:z,DIRECTION_DOWN:N,DIRECTION_HORIZONTAL:X,DIRECTION_VERTICAL:Y,DIRECTION_ALL:F,Manager:Ct,Input:e,TouchAction:H,TouchInput:ft,MouseInput:dt,PointerEventInput:ct,TouchMouseInput:Tt,SingleTouchInput:Ft,Recognizer:At,AttrRecognizer:_t,Tap:zt,Pan:Rt,Swipe:Mt,Pinch:Ot,Rotate:Dt,Press:Nt,on:et,off:nt,each:L,merge:Lt,extend:Wt,assign:a,inherit:function(t,e,n){var i,r=e.prototype;(i=t.prototype=Object.create(r)).constructor=t,i._super=r,n&&a(i,n)},bindFn:function(t,e){return function(){return t.apply(e,arguments)}},prefixed:h,toArray:ht,inArray:rt,uniqueArray:lt,splitStr:tt,boolOrFn:k,hasParent:U,addEventListeners:et,removeEventListeners:nt,defaults:Pt};for(var jt in kt)Xt[jt]=kt[jt];return Xt}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Hammer=e()}(this,function(){"use strict";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function o(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var a,u="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign,c=["","webkit","Moz","MS","ms","o"],t="undefined"==typeof document?{style:{}}:document.createElement("div"),n="function",h=Math.round,b=Math.abs,w=Date.now;function l(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<c.length;){if((i=(n=c[o])?n+r:e)in t)return i;o++}}a="undefined"==typeof window?{}:window;var p=l(t.style,"touchAction"),f=void 0!==p;var v="compute",d="auto",m="manipulation",g="none",y="pan-x",T="pan-y",E=function(){if(!f)return!1;var e={},n=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!n||a.CSS.supports("touch-action",t)}),e}(),I="ontouchstart"in a,A=void 0!==l(a,"PointerEvent"),P=I&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),S="touch",C="mouse",_=25,D=1,O=4,x=8,R=1,M=2,z=4,N=8,X=16,Y=M|z,F=N|X,q=Y|F,W=["x","y"],L=["clientX","clientY"];function k(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function j(t,e){return typeof t===n?t.apply(e&&e[0]||void 0,e):t}function H(t,e){return-1<t.indexOf(e)}var U=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===v&&(t=this.compute()),f&&this.manager.element.style&&E[t]&&(this.manager.element.style[p]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return k(this.manager.recognizers,function(t){j(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(H(t,g))return g;var e=H(t,y),n=H(t,T);return e&&n?g:e||n?e?y:T:H(t,m)?m:d}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=H(i,g)&&!E[g],o=H(i,T)&&!E[T],s=H(i,y)&&!E[y];if(r){var a=1===t.pointers.length,u=t.distance<2,c=t.deltaTime<250;if(a&&u&&c)return}if(!s||!o)return r||o&&n&Y||s&&n&F?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function V(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function G(t){var e=t.length;if(1===e)return{x:h(t[0].clientX),y:h(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:h(n/e),y:h(i/e)}}function Z(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:h(t.pointers[n].clientX),clientY:h(t.pointers[n].clientY)},n++;return{timeStamp:w(),pointers:e,center:G(e),deltaX:t.deltaX,deltaY:t.deltaY}}function B(t,e,n){n||(n=W);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function $(t,e,n){n||(n=W);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function J(t,e){return t===e?R:b(t)>=b(e)?t<0?M:z:e<0?N:X}function K(t,e,n){return{x:e/t||0,y:n/t||0}}function Q(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=Z(e)),1<r&&!n.firstMultiple?n.firstMultiple=Z(e):1===r&&(n.firstMultiple=!1);var o,s,a,u,c,h,l=n.firstInput,p=n.firstMultiple,f=p?p.center:l.center,v=e.center=G(i);e.timeStamp=w(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=$(f,v),e.distance=B(f,v),o=n,a=(s=e).center,u=o.offsetDelta||{},c=o.prevDelta||{},h=o.prevInput||{},s.eventType!==D&&h.eventType!==O||(c=o.prevDelta={x:h.deltaX||0,y:h.deltaY||0},u=o.offsetDelta={x:a.x,y:a.y}),s.deltaX=c.x+(a.x-u.x),s.deltaY=c.y+(a.y-u.y),e.offsetDirection=J(e.deltaX,e.deltaY);var d,m,g,y,T=K(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=T.x,e.overallVelocityY=T.y,e.overallVelocity=b(T.x)>b(T.y)?T.x:T.y,e.scale=p?(d=p.pointers,B((m=i)[0],m[1],L)/B(d[0],d[1],L)):1,e.rotation=p?(g=p.pointers,$((y=i)[1],y[0],L)+$(g[1],g[0],L)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==x&&(_<a||void 0===s.velocity)){var u=e.deltaX-s.deltaX,c=e.deltaY-s.deltaY,h=K(a,u,c);i=h.x,r=h.y,n=b(h.x)>b(h.y)?h.x:h.y,o=J(u,c),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}(n,e);var E=t.element;V(e.srcEvent.target,E)&&(E=e.srcEvent.target),e.target=E}function tt(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&D&&i-r==0,s=e&(O|x)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,Q(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function et(t){return t.trim().split(/\s+/g)}function nt(e,t,n){k(et(t),function(t){e.addEventListener(t,n,!1)})}function it(e,t,n){k(et(t),function(t){e.removeEventListener(t,n,!1)})}function rt(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var e=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){j(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&nt(this.element,this.evEl,this.domHandler),this.evTarget&&nt(this.target,this.evTarget,this.domHandler),this.evWin&&nt(rt(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&it(this.element,this.evEl,this.domHandler),this.evTarget&&it(this.target,this.evTarget,this.domHandler),this.evWin&&it(rt(this.element),this.evWin,this.domHandler)},t}();function ot(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}var st={pointerdown:D,pointermove:2,pointerup:O,pointercancel:x,pointerout:x},at={2:S,3:"pen",4:C,5:"kinect"},ut="pointerdown",ct="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(ut="MSPointerDown",ct="MSPointerMove MSPointerUp MSPointerCancel");var ht=function(n){function i(){var t,e=i.prototype;return e.evEl=ut,e.evWin=ct,(t=n.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return o(i,n),i.prototype.handler=function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=st[i],o=at[t.pointerType]||t.pointerType,s=o===S,a=ot(e,t.pointerId,"pointerId");r&D&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(O|x)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))},i}(e);function lt(t){return Array.prototype.slice.call(t,0)}function pt(t,n,e){for(var i=[],r=[],o=0;o<t.length;){var s=n?t[o][n]:t[o];ot(r,s)<0&&i.push(t[o]),r[o]=s,o++}return e&&(i=n?i.sort(function(t,e){return t[n]>e[n]}):i.sort()),i}var ft={touchstart:D,touchmove:2,touchend:O,touchcancel:x},vt=function(t){function e(){return e.prototype.evTarget="touchstart touchmove touchend touchcancel",e.prototype.targetIds={},t.apply(this,arguments)||this}return o(e,t),e.prototype.handler=function(t){var e=ft[t.type],n=function(t,e){var n,i,r=lt(t.touches),o=this.targetIds;if(e&(2|D)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=lt(t.changedTouches),a=[],u=this.target;if(i=r.filter(function(t){return V(t.target,u)}),e===D)for(n=0;n<i.length;)o[i[n].identifier]=!0,n++;n=0;for(;n<s.length;)o[s[n].identifier]&&a.push(s[n]),e&(O|x)&&delete o[s[n].identifier],n++;return a.length?[pt(i.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:S,srcEvent:t})},e}(e);var dt={mousedown:D,mousemove:2,mouseup:O},mt=function(n){function i(){var t,e=i.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=n.apply(this,arguments)||this).pressed=!1,t}return o(i,n),i.prototype.handler=function(t){var e=dt[t.type];e&D&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=O),this.pressed&&(e&O&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:C,srcEvent:t}))},i}(e),gt=2500,yt=25;function Tt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY},i=this.lastTouches;this.lastTouches.push(n);setTimeout(function(){var t=i.indexOf(n);-1<t&&i.splice(t,1)},gt)}}var Et=function(){return function(n){function t(t,e){var o;return i(s(s(o=n.call(this,t,e)||this)),"handler",function(t,e,n){var i=n.pointerType===S,r=n.pointerType===C;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(t,e){t&D?(this.primaryTouch=e.changedPointers[0].identifier,Tt.call(this,e)):t&(O|x)&&Tt.call(this,e)}).call(s(s(o)),e,n);else if(r&&function(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=yt&&s<=yt)return!0}return!1}.call(s(s(o)),n))return;o.callback(t,e,n)}}),o.touch=new vt(o.manager,o.handler),o.mouse=new mt(o.manager,o.handler),o.primaryTouch=null,o.lastTouches=[],o}return o(t,n),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(e)}();function bt(t,e,n){return!!Array.isArray(t)&&(k(t,n[e],n),!0)}var wt=1;function It(t,e){var n=e.manager;return n?n.get(t):t}function At(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var Pt=function(){function t(t){void 0===t&&(t={}),this.options=r({enable:!0},t),this.id=wt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return u(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(bt(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=It(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return bt(t,"dropRecognizeWith",this)||(t=It(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(bt(t,"requireFailure",this))return this;var e=this.requireFail;return-1===ot(e,t=It(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(bt(t,"dropRequireFailure",this))return this;t=It(t,this);var e=ot(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var n=this,t=this.state;function i(t){n.manager.emit(t,e)}t<8&&i(n.options.event+At(t)),i(n.options.event),e.additionalEvent&&i(e.additionalEvent),8<=t&&i(n.options.event+At(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=u({},t);if(!j(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),St={domEvents:!1,touchAction:v,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ct(n,i){var r,o=n.element;o.style&&(k(n.options.cssProps,function(t,e){r=l(o.style,e),o.style[r]=i?(n.oldCssProps[r]=o.style[r],t):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var _t=function(){function t(t,e){var n,i=this;this.options=u({},St,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(A?ht:P?vt:I?Et:mt))(n,tt),this.touchAction=new U(this,this.options.touchAction),Ct(this,!0),k(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return u(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!==r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),o++}},e.get=function(t){if(t instanceof Pt)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event===t)return e[n];return null},e.add=function(t){if(bt(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(bt(t,"remove",this))return this;var e=this.get(t);if(t){var n=this.recognizers,i=ot(n,e);-1!==i&&(n.splice(i,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var n=this.handlers;return k(et(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var n=this.handlers;return k(et(t),function(t){e?n[t]&&n[t].splice(ot(n[t],e),1):delete n[t]}),this},e.emit=function(t,e){var n,i,r;this.options.domEvents&&(n=t,i=e,(r=document.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var o=this.handlers[t]&&this.handlers[t].slice();if(o&&o.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var s=0;s<o.length;)o[s](e),s++}},e.destroy=function(){this.element&&Ct(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}(),Dt=function(e){function t(t){return void 0===t&&(t={}),e.call(this,r({pointers:1},t))||this}o(t,e);var n=t.prototype;return n.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},n.process=function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&x||!r)?16|e:i||r?n&O?8|e:2&e?4|e:2:32},t}(Pt),Ot=function(e){function t(t){return void 0===t&&(t={}),e.call(this,r({event:"rotate",threshold:0,pointers:2},t))||this}o(t,e);var n=t.prototype;return n.getTouchAction=function(){return[g]},n.attrTest=function(t){return e.prototype.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)},t}(Dt),xt=function(n){function t(t){return void 0===t&&(t={}),n.call(this,r({event:"pinch",threshold:0,pointers:2},t))||this}o(t,n);var e=t.prototype;return e.getTouchAction=function(){return[g]},e.attrTest=function(t){return n.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}n.prototype.emit.call(this,t)},t}(Dt);function Rt(t){return t===X?"down":t===N?"up":t===M?"left":t===z?"right":""}var Mt=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,r({event:"pan",threshold:10,pointers:1,direction:q},t))||this).pX=null,e.pY=null,e}o(t,n);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&Y&&e.push(T),t&F&&e.push(y),e},e.directionTest=function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(i=e.direction&Y?(r=0===o?R:o<0?M:z,n=o!==this.pX,Math.abs(t.deltaX)):(r=0===s?R:s<0?N:X,n=s!==this.pY,Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},e.attrTest=function(t){return Dt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Rt(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}(Dt),zt=function(i){function t(t){return void 0===t&&(t={}),i.call(this,r({event:"swipe",threshold:10,velocity:.3,direction:Y|F,pointers:1},t))||this}o(t,i);var e=t.prototype;return e.getTouchAction=function(){return Mt.prototype.getTouchAction.call(this)},e.attrTest=function(t){var e,n=this.options.direction;return n&(Y|F)?e=t.overallVelocity:n&Y?e=t.overallVelocityX:n&F&&(e=t.overallVelocityY),i.prototype.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers===this.options.pointers&&b(e)>this.options.velocity&&t.eventType&O},e.emit=function(t){var e=Rt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)},t}(Dt),Nt=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,r({event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},t))||this).pTime=!1,e.pCenter=!1,e._timer=null,e._input=null,e.count=0,e}o(t,n);var e=t.prototype;return e.getTouchAction=function(){return[m]},e.process=function(t){var e=this,n=this.options,i=t.pointers.length===n.pointers,r=t.distance<n.threshold,o=t.deltaTime<n.time;if(this.reset(),t.eventType&D&&0===this.count)return this.failTimeout();if(r&&o&&i){if(t.eventType!==O)return this.failTimeout();var s=!this.pTime||t.timeStamp-this.pTime<n.interval,a=!this.pCenter||B(this.pCenter,t.center)<n.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,a&&s?this.count+=1:this.count=1,this._input=t,0===this.count%n.taps)return this.hasRequireFailures()?(this._timer=setTimeout(function(){e.state=8,e.tryEmit()},n.interval),2):8}return 32},e.failTimeout=function(){var t=this;return this._timer=setTimeout(function(){t.state=32},this.options.interval),32},e.reset=function(){clearTimeout(this._timer)},e.emit=function(){8===this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))},t}(Pt),Xt=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,r({event:"press",pointers:1,time:251,threshold:9},t))||this)._timer=null,e._input=null,e}o(t,n);var e=t.prototype;return e.getTouchAction=function(){return[d]},e.process=function(t){var e=this,n=this.options,i=t.pointers.length===n.pointers,r=t.distance<n.threshold,o=t.deltaTime>n.time;if(this._input=t,!r||!i||t.eventType&(O|x)&&!o)this.reset();else if(t.eventType&D)this.reset(),this._timer=setTimeout(function(){e.state=8,e.tryEmit()},n.time);else if(t.eventType&O)return 8;return 32},e.reset=function(){clearTimeout(this._timer)},e.emit=function(t){8===this.state&&(t&&t.eventType&O?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=w(),this.manager.emit(this.options.event,this._input)))},t}(Pt),Yt=function(){var t=function(t,e){return void 0===e&&(e={}),new _t(t,r({recognizers:[[Ot,{enable:!1}],[xt,{enable:!1},["rotate"]],[zt,{direction:Y}],[Mt,{direction:Y},["swipe"]],[Nt],[Nt,{event:"doubletap",taps:2},["tap"]],[Xt]]},e))};return i(t,"VERSION","2.0.12"),t}(),Ft={touchstart:D,touchmove:2,touchend:O,touchcancel:x},qt=function(n){function i(){var t,e=i.prototype;return e.evTarget="touchstart",e.evWin="touchstart touchmove touchend touchcancel",(t=n.apply(this,arguments)||this).started=!1,t}return o(i,n),i.prototype.handler=function(t){var e=Ft[t.type];if(e===D&&(this.started=!0),this.started){var n=function(t,e){var n=lt(t.touches),i=lt(t.changedTouches);e&(O|x)&&(n=pt(n.concat(i),"identifier",!0));return[n,i]}.call(this,t,e);e&(O|x)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:S,srcEvent:t})}},i}(e);function Wt(i,t,e){var r="DEPRECATED METHOD: "+t+"\n"+e+" AT \n";return function(){var t=new Error("get-stack-trace"),e=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=window.console&&(window.console.warn||window.console.log);return n&&n.call(window.console,r,e),i.apply(this,arguments)}}var Lt=Wt(function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&void 0===t[i[r]])&&(t[i[r]]=e[i[r]]),r++;return t},"extend","Use `assign`."),kt=Wt(function(t,e){return Lt(t,e,!0)},"merge","Use `assign`.");var jt={default:Yt,INPUT_START:D,INPUT_MOVE:2,INPUT_END:O,INPUT_CANCEL:x,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:R,DIRECTION_LEFT:M,DIRECTION_RIGHT:z,DIRECTION_UP:N,DIRECTION_DOWN:X,DIRECTION_HORIZONTAL:Y,DIRECTION_VERTICAL:F,DIRECTION_ALL:q,Manager:_t,Input:e,TouchAction:U,TouchInput:vt,MouseInput:mt,PointerEventInput:ht,TouchMouseInput:Et,SingleTouchInput:qt,Recognizer:Pt,AttrRecognizer:Dt,Tap:Nt,Pan:Mt,Swipe:zt,Pinch:xt,Rotate:Ot,Press:Xt,on:nt,off:it,each:k,merge:kt,extend:Lt,assign:u,inherit:function(t,e,n){var i,r=e.prototype;(i=t.prototype=Object.create(r)).constructor=t,i._super=r,n&&u(i,n)},bindFn:function(t,e){return function(){return t.apply(e,arguments)}},prefixed:l,toArray:lt,inArray:ot,uniqueArray:pt,splitStr:et,boolOrFn:j,hasParent:V,addEventListeners:nt,removeEventListeners:it,defaults:St};for(var Ht in jt)Yt[Ht]=jt[Ht];return Yt}); | ||
//# sourceMappingURL=hammer.min.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "A javascript library for multi-touch gestures", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"homepage": "http://naver.github.io/egjs", | ||
@@ -54,3 +54,3 @@ "license": "MIT", | ||
"scripts": { | ||
"build": "npm run rollup", | ||
"build": "npm run rollup && npm run test:node", | ||
"testbuild": "rollup -c ./testrollup.config.js", | ||
@@ -65,3 +65,4 @@ "bannerize": "bannerize hammer.js hammer.min.js", | ||
"watch-tasks": "npm run rollup && npm run string-replace && npm run uglify && npm run jshint && npm run jscs", | ||
"test": "npm run build && npm run qunit" | ||
"test": "npm run build && npm run qunit", | ||
"test:node": "node ./dist/hammer.js" | ||
}, | ||
@@ -68,0 +69,0 @@ "sideEffects": false, |
@@ -11,2 +11,3 @@ import { | ||
} from '../inputjs/input-consts'; | ||
import {window} from "../browser"; | ||
import Input from '../inputjs/input-constructor'; | ||
@@ -13,0 +14,0 @@ import inArray from '../utils/in-array'; |
import prefixed from '../utils/prefixed'; | ||
import {window} from "../browser"; | ||
@@ -3,0 +4,0 @@ const MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; |
import prefixed from '../utils/prefixed'; | ||
import { TEST_ELEMENT } from '../utils/utils-consts'; | ||
import {window} from '../browser'; | ||
@@ -4,0 +5,0 @@ export const PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); |
@@ -0,3 +1,4 @@ | ||
const VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; | ||
const TEST_ELEMENT = document.createElement('div'); | ||
const TEST_ELEMENT = typeof document === "undefined" ? {style: {}} : document.createElement('div'); | ||
@@ -4,0 +5,0 @@ const TYPE_FUNCTION = 'function'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
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
774256
118
9429