1
|
"use strict";angular.module("angular-gestures",[]);var HGESTURES={hmDoubleTap:"doubletap",hmDragstart:"panstart",hmDrag:"pan",hmDragUp:"panup",hmDragDown:"pandown",hmDragLeft:"panleft",hmDragRight:"panright",hmDragend:"panend",hmPanstart:"panstart",hmPan:"pan",hmPanUp:"panup",hmPanDown:"pandown",hmPanLeft:"panleft",hmPanRight:"panright",hmPanend:"panend",hmHold:"press",hmPinch:"pinch",hmPinchIn:"pinchin",hmPinchOut:"pinchout",hmPress:"press",hmRelease:"release",hmRotate:"rotate",hmSwipe:"swipe",hmSwipeUp:"swipeup",hmSwipeDown:"swipedown",hmSwipeLeft:"swipeleft",hmSwipeRight:"swiperight",hmTap:"tap",hmTouch:"touch",hmTransformstart:"transformstart",hmTransform:"transform",hmTransformend:"transformend"},HRECOGNIZERS={hmDoubleTap:[Hammer.Tap,"Hammer.Tap"],hmDragstart:[Hammer.Pan,"Hammer.Pan"],hmDrag:[Hammer.Pan,"Hammer.Pan"],hmDragUp:[Hammer.Pan,"Hammer.Pan"],hmDragDown:[Hammer.Pan,"Hammer.Pan"],hmDragLeft:[Hammer.Pan,"Hammer.Pan"],hmDragRight:[Hammer.Pan,"Hammer.Pan"],hmDragend:[Hammer.Pan,"Hammer.Pan"],hmPanstart:[Hammer.Pan,"Hammer.Pan"],hmPan:[Hammer.Pan,"Hammer.Pan"],hmPanUp:[Hammer.Pan,"Hammer.Pan"],hmPanDown:[Hammer.Pan,"Hammer.Pan"],hmPanLeft:[Hammer.Pan,"Hammer.Pan"],hmPanRight:[Hammer.Pan,"Hammer.Pan"],hmPanend:[Hammer.Pan,"Hammer.Pan"],hmHold:[Hammer.Press,"Hammer.Press"],hmPinch:[Hammer.Pinch,"Hammer.Pinch"],hmPinchIn:[Hammer.Pinch,"Hammer.Pinch"],hmPinchOut:[Hammer.Pinch,"Hammer.Pinch"],hmPress:[Hammer.Press,"Hammer.Press"],hmRotate:[Hammer.Rotate,"Hammer.Rotate"],hmSwipe:[Hammer.Swipe,"Hammer.Swipe"],hmSwipeUp:[Hammer.Swipe,"Hammer.Swipe"],hmSwipeDown:[Hammer.Swipe,"Hammer.Swipe"],hmSwipeLeft:[Hammer.Swipe,"Hammer.Swipe"],hmSwipeRight:[Hammer.Swipe,"Hammer.Swipe"],hmTap:[Hammer.Tap,"Hammer.Tap"]},VERBOSE=!1;angular.forEach(HGESTURES,function(a,b){angular.module("angular-gestures").directive(b,["$parse","$log","$timeout","hammerDefaultOpts",function(c,d,e,f){return function(e,g,h){var i;h.$observe(b,function(j){var k=c(j),l=c(h[b+"Opts"])(e,{}),m=angular.copy(f);if(angular.extend(m,l),angular.isUndefined(g.hammertime)){var n=angular.isDefined(m.recognizers)?m.recognizers:[],o=HRECOGNIZERS[b];if(angular.isDefined(o)){var p=!1;if(angular.forEach(n,function(a){o[0]===a[0]&&(angular.isUndefined(a[1].enable)||a[1].enable===!0)&&(p=!0)}),!p)throw new Error("Directive "+b+" requires gesture recognizer ["+o[1]+"] to be enabled")}g.hammer=new Hammer.Manager(g[0],m),e.$on("$destroy",function(){g.hammer.off(a),g.hammer.destroy()})}i=function(b){VERBOSE&&d.debug("angular-gestures: ",a,b);var c=function(){var a=k(e,{$event:b});"function"==typeof a&&a.call(e,b)};"$apply"===e.$root.$$phase||"$digest"===e.$root.$$phase?c():e.$apply(c)},g.hammer.on(a,i)})}}])}),angular.module("angular-gestures").provider("hammerDefaultOpts",function(){var a={};this.set=function(b){a=b},this.$get=function(){return a}});
|