UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 2.79 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("kendo.core.js"),require("kendo.userevents.js")):"function"==typeof define&&define.amd?define(["exports","kendo.core.min","kendo.userevents"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Touch={}))}(this,(function(e){!function(){var e=window.kendo,t=e.ui.Widget,n=Math.abs,i=t.extend({init:function(n,i){var o=this;function a(e){return function(t){o._triggerTouch(e,t)}}function s(e){return function(t){o.trigger(e,{touches:t.touches,distance:t.distance,center:t.center,event:t.event})}}t.fn.init.call(o,n,i),i=o.options,n=o.element,o.wrapper=n,o.events=new e.UserEvents(n,{filter:i.filter,surface:i.surface,minHold:i.minHold,multiTouch:i.multiTouch,allowSelection:!0,fastTap:i.fastTap,press:a("touchstart"),hold:a("hold"),tap:o._tap.bind(o),gesturestart:s("gesturestart"),gesturechange:s("gesturechange"),gestureend:s("gestureend")}),i.enableSwipe?(o.events.bind("start",o._swipestart.bind(o)),o.events.bind("move",o._swipemove.bind(o))):(o.events.bind("start",o._dragstart.bind(o)),o.events.bind("move",a("drag")),o.events.bind("end",a("dragend"))),e.notify(o)},events:["touchstart","dragstart","drag","dragend","tap","doubletap","hold","swipe","gesturestart","gesturechange","gestureend"],options:{name:"Touch",surface:null,global:!1,fastTap:!1,filter:null,multiTouch:!1,enableSwipe:!1,minXDelta:30,maxYDelta:20,maxDuration:1e3,minHold:800,doubleTapTimeout:800},cancel:function(){this.events.cancel()},destroy:function(){t.fn.destroy.call(this),this.events.destroy()},_triggerTouch:function(e,t){this.trigger(e,{touch:t.touch,event:t.event})&&t.preventDefault()},_tap:function(t){var n=this,i=n.lastTap,o=t.touch;i&&o.endTime-i.endTime<n.options.doubleTapTimeout&&e.touchDelta(o,i).distance<20?(n._triggerTouch("doubletap",t),n.lastTap=null):(n._triggerTouch("tap",t),n.lastTap=o)},_dragstart:function(e){this._triggerTouch("dragstart",e)},_swipestart:function(e){2*n(e.x.velocity)>=n(e.y.velocity)&&e.sender.capture()},_swipemove:function(e){var t=this.options,i=e.touch,o=e.event.timeStamp-i.startTime,a=i.x.initialDelta>0?"right":"left";n(i.x.initialDelta)>=t.minXDelta&&n(i.y.initialDelta)<t.maxYDelta&&o<t.maxDuration&&(this.trigger("swipe",{direction:a,touch:e.touch}),i.cancel())}});e.ui.plugin(i)}(window.kendo.jQuery);var t=kendo;e.__meta__={id:"touch",name:"Touch",category:"mobile",description:"The kendo Touch widget provides a cross-platform compatible API for handling user-initiated touch events, multi-touch gestures and event sequences (drag, swipe, etc.). ",depends:["core","userevents"]},e.default=t,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=kendo.touch.min.js.map