/* * Kendo UI Web v2013.1.319 (http://kendoui.com) * Copyright 2013 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"==typeof define&&define.amd?define:function(t,e){return e()})(["./kendo.core.min"],function(){(function(t){function e(t,e){var n=t.x.location,i=t.y.location,o=e.x.location,r=e.y.location,a=n-o,s=i-r;return{center:{x:(n+o)/2,y:(i+r)/2},distance:Math.sqrt(a*a+s*s)}}function n(t){var e,n,i,o=[],a=t.originalEvent,s=t.currentTarget,c=0;if(t.api)o.push({id:2,event:t,target:t.target,currentTarget:t.target,location:t});else if(t.type.match(/touch/))for(n=a?a.changedTouches:[],e=n.length;e>c;c++)i=n[c],o.push({location:i,event:t,target:i.target,currentTarget:s,id:i.identifier});else r.pointers?o.push({location:a,event:t,target:t.target,currentTarget:s,id:a.pointerId}):o.push({id:1,event:t,target:t.target,currentTarget:s,location:t});return o}function i(e){e.preventDefault();var n=t(e.data.root),i=n.closest(".k-widget").parent();i[0]||(i=n.parent()),i.trigger(t.Event(e.type,{target:n[0]}))}var o=window.kendo,r=o.support,a=r.pointers,s=window.document,c=t(s.documentElement),u=o.Class,h=o.Observable,l=t.now,d=t.extend,p=r.mobileOS,f=p&&p.android,g="press",v="select",_="start",m="move",T="end",y="cancel",x="tap",w="gesturestart",E="gesturechange",D="gestureend",M="gesturetap",S=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||!f)&&(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 S("X",n.location),y:new S("Y",n.location),userEvents:t,target:e,currentTarget:n.currentTarget,initialTouch:n.target,id:n.id,_moved:!1,_finished:!1}),i.notifyInit=function(){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(m,t)}},end:function(t){var e=this;e.endTime=l(),e._finished||(e._moved?e._trigger(T,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(_,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 Math.sqrt(t*t+e*e)<=this.userEvents.threshold}}),k=h.extend({init:function(e,n){var i,s,u,l,p,f,S=this,b=o.guid();if(n=n||{},i=S.filter=n.filter,S.threshold=n.threshold||0,S.touches=[],S._maxTouches=n.multiTouch?2:1,S.allowSelection=n.allowSelection,S.eventNS=b,e=t(e).handler(S),h.fn.init.call(S),d(S,{element:e,surface:n.global?c:n.surface||e,stopPropagation:n.stopPropagation,pressed:!1}),S.surface.handler(S).on(o.applyEventMap("move",b),"_move").on(o.applyEventMap("up cancel",b),"_end"),e.on(o.applyEventMap("down",b),i,"_start"),a&&e.css("-ms-touch-action","pinch-zoom double-tap-zoom"),n.preventDragEvent&&e.on(o.applyEventMap("dragstart",b),o.preventDefault),e.on(o.applyEventMap("mousedown selectstart",b),i,{root:e},"_select"),r.eventCapture)for(s=o.eventMap.up.split(" "),u=0,l=s.length,p=S.surface[0],f=function(t){S._isMoved()&&t.preventDefault()};l>u;u++)p.addEventListener(s[u],f,!0);S.bind([g,x,_,m,T,y,w,E,D,M,v],n)},destroy:function(){var t=this;t.element.kendoDestroy(t.eventNS),t.surface.kendoDestroy(t.eventNS),t._disposeAll(),t.unbind()},capture:function(){k.current=this},cancel:function(){this._disposeAll(),this.trigger(y)},notify:function(t,n){var i=this,o=i.touches;if(this._isMultiTouch()){switch(t){case m:t=E;break;case T:t=D;break;case x:t=M}d(n,{touches:o},e(o[0],o[1]))}return this.trigger(t,n)},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},_select:function(t){(!this.allowSelection||this.trigger(v,{event:t}))&&i(t)},_start:function(e){var i,o,r=this,a=0,s=r.filter,c=n(e),u=c.length;if(!r._maxTouchesReached())for(k.current=null,r.currentTarget=e.currentTarget,r.stopPropagation&&e.stopPropagation();u>a&&!r._maxTouchesReached();a++)o=c[a],i=s?t(o.currentTarget):r.element,i.length&&(o=new b(r,i,o),r.touches.push(o),o.notifyInit(),r._isMultiTouch()&&r.notify("gesturestart",{}))},_move:function(t){this._eachTouch("move",t)},_end:function(t){this._eachTouch("end",t)},_eachTouch:function(t,e){var i,o,r,a,s=this,c={},u=n(e),h=s.touches;for(i=0;h.length>i;i++)o=h[i],c[o.id]=o;for(i=0;u.length>i;i++)r=u[i],a=c[r.id],a&&a[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=n,o.touchDelta=e,o.UserEvents=k})(window.kendo.jQuery)});