/* * Kendo UI Web v2012.3.1114 (http://kendoui.com) * Copyright 2012 Telerik AD. All rights reserved. * * Kendo UI Web commercial licenses may be obtained at * https://www.kendoui.com/purchase/license-agreement/kendo-ui-web-commercial.aspx * If you do not own a commercial license, this file shall be governed by the * GNU General Public License (GPL) version 3. * For GPL requirements, please review: http://www.gnu.org/copyleft/gpl.html */ (function(t){function e(e){e.preventDefault();var n=t(e.currentTarget),i=n.closest(".k-widget").parent();i[0]||(i=n.parent()),i.trigger(t.Event(e.type,{target:n}))}function n(t,e){var n=t.x.location,i=t.y.location,o=e.x.location,r=e.y.location,s=n-o,a=i-r;return{center:{x:(n+o)/2,y:(i+r)/2},distance:Math.sqrt(s*s+a*a)}}function i(t){var e,n,i,o=[],s=t.originalEvent,a=0;if(t.api)o.push({id:2,event:t,target:t.target,location:t});else if(t.type.match(/touch/))for(n=s?s.changedTouches:[],e=n.length;e>a;a++)i=n[a],o.push({location:i,event:t,target:i.target,id:i.identifier});else r.pointers?o.push({location:s,event:t,target:t.target,id:s.pointerId}):o.push({id:1,event:t,target:t.target,location:t});return o}var o=window.kendo,r=o.support,s=r.pointers,a=window.document,c=t(a.documentElement),u=o.Class,h=o.Observable,l=t.now,d=t.extend,f=r.mobileOS,p=f&&f.android,g="press",v="start",_="move",m="end",T="cancel",x="tap",y="gesturestart",w="gesturechange",D="gestureend",E="gesturetap",M=u.extend({init:function(t,e){var n=this;n.axis=t,n._updateLocationData(e),n.startLocation=n.location,n.velocity=n.delta=0,n.timeStamp=l()},move:function(t){var e=this,n=t["page"+e.axis],i=l(),o=i-e.timeStamp||1;(n||!p)&&(e.delta=n-e.location,e._updateLocationData(t),e.initialDelta=n-e.startLocation,e.velocity=e.delta/o,e.timeStamp=i)},_updateLocationData:function(t){var e=this,n=e.axis;e.location=t["page"+n],e.client=t["client"+n],e.screen=t["screen"+n]}}),b=u.extend({init:function(t,e,n){var i=this;d(i,{x:new M("X",n.location),y:new M("Y",n.location),userEvents:t,target:e,currentTarget:n.currentTarget,id:n.id,_moved:!1,_finished:!1}),i._trigger(g,n)},move:function(t){var e=this;if(!e._finished){if(e.x.move(t.location),e.y.move(t.location),!e._moved){if(e._withinIgnoreThreshold())return;if(k.current&&k.current!==e.userEvents)return e.dispose();e._start(t)}e._finished||e._trigger(_,t)}},end:function(t){var e=this;e.endTime=l(),e._finished||(e._moved?e._trigger(m,t):e._trigger(x,t),e.dispose())},dispose:function(){var e=this,n=e.userEvents,i=n.touches;e._finished=!0,i.splice(t.inArray(e,i),1)},skip:function(){this.dispose()},cancel:function(){this.dispose()},isMoved:function(){return this._moved},_start:function(t){this.startTime=l(),this._moved=!0,this._trigger(v,t)},_trigger:function(t,e){var n=this,i=e.event,o={touch:n,x:n.x,y:n.y,target:n.target,event:i};n.userEvents.notify(t,o)&&i.preventDefault()},_withinIgnoreThreshold:function(){var t=this.x.initialDelta,e=this.y.initialDelta;return this.userEvents.threshold>=Math.sqrt(t*t+e*e)}}),k=h.extend({init:function(n,i){var a,u=this;if(i=i||{},a=u.filter=i.filter,u.threshold=i.threshold||0,u.touches=[],u._maxTouches=i.multiTouch?2:1,n=t(n).handler(u),h.fn.init.call(u),d(u,{element:n,surface:i.global?c:i.surface||n,stopPropagation:i.stopPropagation,pressed:!1}),u.surface.handler(u).on("move","_move").on("up cancel","_end"),n.on("down",a,"_start"),s&&n.css("-ms-touch-action","pinch-zoom double-tap-zoom"),i.preventDragEvent&&n.on("dragstart",o.preventDefault),i.allowSelection||n.on("mousedown selectstart",a,e),r.eventCapture)for(var l=o.eventMap.up.split(" "),f=0,p=l.length,M=u.surface[0],b=function(t){u._isMoved()&&t.preventDefault()};p>f;f++)M.addEventListener(l[f],b,!0);u.bind([g,x,v,_,m,T,y,w,D,E],i)},destroy:function(){this.element.kendoDestroy(),this.surface.kendoDestroy(),this._disposeAll()},capture:function(){k.current=this},cancel:function(){this._disposeAll(),this.trigger(T)},notify:function(e,i){var o=this,r=o.touches;if(this._isMultiTouch()){switch(e){case _:e=w;break;case m:e=D;break;case x:e=E}t.extend(i,{touches:r},n(r[0],r[1]))}return this.trigger(e,i)},press:function(t,e,n){this._apiCall("_start",t,e,n)},move:function(t,e){this._apiCall("_move",t,e)},end:function(t,e){this._apiCall("_end",t,e)},_isMultiTouch:function(){return this.touches.length>1},_maxTouchesReached:function(){return this.touches.length>=this._maxTouches},_disposeAll:function(){t.each(this.touches,function(){this.dispose()})},_isMoved:function(){return t.grep(this.touches,function(t){return t.isMoved()}).length},_isPressed:function(){return this.touches.length},_start:function(e){var n,o,r=this,s=0,a=r.filter,c=i(e),u=c.length;if(!r._maxTouchesReached())for(k.current=null,r.currentTarget=e.currentTarget,r.stopPropagation&&e.stopPropagation();u>s&&!r._maxTouchesReached();s++)o=c[s],n=t(o.target),n=a?n.is(a)?n:n.closest(a):r.element,n.length&&(r.touches.push(new b(r,n,o)),r._isMultiTouch()&&r.notify("gesturestart",{}))},_move:function(t){this._eachTouch("move",t)},_end:function(t){this._eachTouch("end",t)},_eachTouch:function(t,e){var n,o,r,s,a=this,c={},u=i(e),h=a.touches;for(n=0;h.length>n;n++)o=h[n],c[o.id]=o;for(n=0;u.length>n;n++)r=u[n],s=c[r.id],s&&s[t](r)},_apiCall:function(e,n,i,o){this[e]({api:!0,pageX:n,pageY:i,target:o||this.element,stopPropagation:t.noop,preventDefault:t.noop})}});o.getTouches=i,o.touchDelta=n,o.UserEvents=k})(window.kendo.jQuery);