UNPKG

@progress/telerik-jquery-report-viewer

Version:

Progress® Telerik® Report Viewer for jQuery

87 lines (83 loc) 2.07 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function TouchBehavior(dom, options) { var startDistance; var ignoreTouch; init(dom); function init(element) { if (typeof $.fn.kendoTouch === "function") { try { $(element).mousedown(function() { ignoreTouch = true; }).mouseup(function() { ignoreTouch = false; }).kendoTouch({ multiTouch: true, enableSwipe: true, swipe: function(e) { if (!ignoreTouch) { onSwipe(e); } }, gesturestart: function(e) { if (!ignoreTouch) { onGestureStart(e); } }, gestureend: function(e) { if (!ignoreTouch) { onGestureEnd(e); } }, gesturechange: function(e) { if (!ignoreTouch) { onGestureChange(e); } }, doubletap: function(e) { if (!ignoreTouch) { onDoubleTap(e); } }, touchstart: function(e) { if (!ignoreTouch) { fire("touchstart"); } } }); } catch (e) { console.error("Instantiation of Kendo Touch threw an exception", e); throw e; } } } function onDoubleTap(e) { fire("doubletap", e); } function onGestureStart(e) { startDistance = kendo.touchDelta(e.touches[0], e.touches[1]).distance; } function onGestureEnd(e) { } function onGestureChange(e) { var current = kendo.touchDelta(e.touches[0], e.touches[1]).distance; onPinch({ distance: current, lastDistance: startDistance }); startDistance = current; } function onSwipe(e) { fire("swipe", e); } function onPinch(e) { fire("pinch", e); } function fire(func, args) { var handler = options[func]; if (typeof handler === "function") { handler(args); } } } exports.TouchBehavior = TouchBehavior;