/*! hammer.js - v2.0.4 - 2014-09-28 * http://hammerjs.github.io/ * * copyright (c) 2014 jorik tangelder; * licensed under the mit license */ !function(a,b,c,d){"use strict";function e(a,b,c){return settimeout(k(a,c),b)}function f(a,b,c){return array.isarray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.foreach)a.foreach(b,c);else if(a.length!==d)for(e=0;e-1}function r(a){return a.trim().split(/\s+/g)}function s(a,b,c){if(a.indexof&&!c)return a.indexof(b);for(var d=0;dc[b]}):d.sort()),d}function v(a,b){for(var c,e,f=b[0].touppercase()+b.slice(1),g=0;g1&&!c.firstmultiple?c.firstmultiple=e(b):1===e&&(c.firstmultiple=!1);var f=c.firstinput,g=c.firstmultiple,h=g?g.center:f.center,i=b.center=f(d);b.timestamp=nb(),b.deltatime=b.timestamp-f.timestamp,b.angle=j(h,i),b.distance=i(h,i),c(c,b),b.offsetdirection=h(b.deltax,b.deltay),b.scale=g?l(g.pointers,d):1,b.rotation=g?k(g.pointers,d):0,d(c,b);var j=a.element;p(b.srcevent.target,j)&&(j=b.srcevent.target),b.target=j}function c(a,b){var c=b.center,d=a.offsetdelta||{},e=a.prevdelta||{},f=a.previnput||{};(b.eventtype===yb||f.eventtype===ab)&&(e=a.prevdelta={x:f.deltax||0,y:f.deltay||0},d=a.offsetdelta={x:c.x,y:c.y}),b.deltax=e.x+(c.x-d.x),b.deltay=e.y+(c.y-d.y)}function d(a,b){var c,e,f,g,h=a.lastinterval||b,i=b.timestamp-h.timestamp;if(b.eventtype!=bb&&(i>xb||h.velocity===d)){var j=h.deltax-b.deltax,k=h.deltay-b.deltay,l=g(i,j,k);e=l.x,f=l.y,c=mb(l.x)>mb(l.y)?l.x:l.y,g=h(j,k),a.lastinterval=b}else c=h.velocity,e=h.velocityx,f=h.velocityy,g=h.direction;b.velocity=c,b.velocityx=e,b.velocityy=f,b.direction=g}function e(a){for(var b=[],c=0;ce;)c+=a[e].clientx,d+=a[e].clienty,e++;return{x:lb(c/b),y:lb(d/b)}}function g(a,b,c){return{x:b/a||0,y:c/a||0}}function h(a,b){return a===b?cb:mb(a)>=mb(b)?a>0?db:eb:b>0?fb:gb}function i(a,b,c){c||(c=kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return math.sqrt(d*d+e*e)}function j(a,b,c){c||(c=kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*math.atan2(e,d)/math.pi}function k(a,b){return j(b[1],b[0],lb)-j(a[1],a[0],lb)}function l(a,b){return i(b[0],b[1],lb)/i(a[0],a[1],lb)}function m(){this.evel=nb,this.evwin=ob,this.allow=!0,this.pressed=!1,y.apply(this,arguments)}function n(){this.evel=rb,this.evwin=sb,y.apply(this,arguments),this.store=this.manager.session.pointerevents=[]}function o(){this.evtarget=ub,this.evwin=vb,this.started=!1,y.apply(this,arguments)}function p(a,b){var c=t(a.touches),d=t(a.changedtouches);return b&(ab|bb)&&(c=u(c.concat(d),"identifier",!0)),[c,d]}function q(){this.evtarget=xb,this.targetids={},y.apply(this,arguments)}function r(a,b){var c=t(a.touches),d=this.targetids;if(b&(yb|zb)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=t(a.changedtouches),h=[],i=this.target;if(f=c.filter(function(a){return p(a.target,i)}),b===yb)for(e=0;eh&&(b.push(a),h=b.length-1):e&(ab|bb)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedpointers:[a],pointertype:f,srcevent:a}),c&&b.splice(h,1))}});var tb={touchstart:yb,touchmove:zb,touchend:ab,touchcancel:bb},ub="touchstart",vb="touchstart touchmove touchend touchcancel";j(o,y,{handler:function(a){var b=tb[a.type];if(b===yb&&(this.started=!0),this.started){var c=p.call(this,a,b);b&(ab|bb)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedpointers:c[1],pointertype:tb,srcevent:a})}}});var wb={touchstart:yb,touchmove:zb,touchend:ab,touchcancel:bb},xb="touchstart touchmove touchend touchcancel";j(q,y,{handler:function(a){var b=wb[a.type],c=r.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedpointers:c[1],pointertype:tb,srcevent:a})}}),j(s,y,{handler:function(a,b,c){var d=c.pointertype==tb,e=c.pointertype==vb;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(ab|bb)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var yb=v(jb.style,"touchaction"),zb=yb!==d,$b="compute",_b="auto",ac="manipulation",bc="none",cc="pan-x",dc="pan-y";t.prototype={set:function(a){a==$b&&(a=this.compute()),zb&&(this.manager.element.style[yb]=a),this.actions=a.tolowercase().trim()},update:function(){this.set(this.manager.options.touchaction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){l(b.options.enable,[b])&&(a=a.concat(b.gettouchaction()))}),u(a.join(" "))},preventdefaults:function(a){if(!zb){var b=a.srcevent,c=a.offsetdirection;if(this.manager.session.prevented)return void b.preventdefault();var d=this.actions,e=q(d,bc),f=q(d,dc),g=q(d,cc);return e||f&&c&hb||g&&c&ib?this.preventsrc(b):void 0}},preventsrc:function(a){this.manager.session.prevented=!0,a.preventdefault()}};var ec=1,fc=2,gc=4,hc=8,ic=hc,jc=16,kc=32;v.prototype={defaults:{},set:function(a){return h(this.options,a),this.manager&&this.manager.touchaction.update(),this},recognizewith:function(a){if(f(a,"recognizewith",this))return this;var b=this.simultaneous;return a=y(a,this),b[a.id]||(b[a.id]=a,a.recognizewith(this)),this},droprecognizewith:function(a){return f(a,"droprecognizewith",this)?this:(a=y(a,this),delete this.simultaneous[a.id],this)},requirefailure:function(a){if(f(a,"requirefailure",this))return this;var b=this.requirefail;return a=y(a,this),-1===s(b,a)&&(b.push(a),a.requirefailure(this)),this},droprequirefailure:function(a){if(f(a,"droprequirefailure",this))return this;a=y(a,this);var b=s(this.requirefail,a);return b>-1&&this.requirefail.splice(b,1),this},hasrequirefailures:function(){return this.requirefail.length>0},canrecognizewith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(c.options.event+(b?w(d):""),a)}var c=this,d=this.state;hc>d&&b(!0),b(),d>=hc&&b(!0)},tryemit:function(a){return this.canemit()?this.emit(a):void(this.state=kc)},canemit:function(){for(var a=0;af?db:eb,c=f!=this.px,d=math.abs(a.deltax)):(e=0===g?cb:0>g?fb:gb,c=g!=this.py,d=math.abs(a.deltay))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrtest:function(a){return z.prototype.attrtest.call(this,a)&&(this.state&fc||!(this.state&fc)&&this.directiontest(a))},emit:function(a){this.px=a.deltax,this.py=a.deltay;var b=x(a.direction);b&&this.manager.emit(this.options.event+b,a),this._super.emit.call(this,a)}}),j(_,z,{defaults:{event:"pinch",threshold:0,pointers:2},gettouchaction:function(){return[bc]},attrtest:function(a){return this._super.attrtest.call(this,a)&&(math.abs(a.scale-1)>this.options.threshold||this.state&fc)},emit:function(a){if(this._super.emit.call(this,a),1!==a.scale){var b=a.scale<1?"in":"out";this.manager.emit(this.options.event+b,a)}}}),j(ab,v,{defaults:{event:"press",pointers:1,time:500,threshold:5},gettouchaction:function(){return[_b]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,!d||!c||a.eventtype&(ab|bb)&&!f)this.reset();else if(a.eventtype&yb)this.reset(),this._timer=e(function(){this.state=ic,this.tryemit()},b.time,this);else if(a.eventtype&ab)return ic;return kc},reset:function(){cleartimeout(this._timer)},emit:function(a){this.state===ic&&(a&&a.eventtype&ab?this.manager.emit(this.options.event+"up",a):(this._input.timestamp=nb(),this.manager.emit(this.options.event,this._input)))}}),j(bb,z,{defaults:{event:"rotate",threshold:0,pointers:2},gettouchaction:function(){return[bc]},attrtest:function(a){return this._super.attrtest.call(this,a)&&(math.abs(a.rotation)>this.options.threshold||this.state&fc)}}),j(cb,z,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:hb|ib,pointers:1},gettouchaction:function(){return $.prototype.gettouchaction.call(this)},attrtest:function(a){var b,c=this.options.direction;return c&(hb|ib)?b=a.velocity:c&hb?b=a.velocityx:c&ib&&(b=a.velocityy),this._super.attrtest.call(this,a)&&c&a.direction&&a.distance>this.options.threshold&&mb(b)>this.options.velocity&&a.eventtype&ab},emit:function(a){var b=x(a.direction);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),j(db,v,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posthreshold:10},gettouchaction:function(){return[ac]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance