forked from RyanMullins/angular-hammer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular.hammer.min.js
More file actions
3 lines (3 loc) · 2.77 KB
/
angular.hammer.min.js
File metadata and controls
3 lines (3 loc) · 2.77 KB
1
2
3
// Copyright (c) 2014 Ryan S Mullins <ryan@ryanmullins.org>
// Licensed under the MIT Software License
!function(e,n,t){"use strict";function i(e,n){var i;return n.type&&(n.type.indexOf("pan")>-1&&(i=new t.Pan(n)),n.type.indexOf("pinch")>-1&&(i=new t.Pinch(n)),n.type.indexOf("press")>-1&&(i=new t.Press(n)),n.type.indexOf("rotate")>-1&&(i=new t.Rotate(n)),n.type.indexOf("swipe")>-1&&(i=new t.Swipe(n)),n.type.indexOf("tap")>-1&&(i=new t.Tap(n))),e&&i?(e.add(i),i):void 0}function o(e,n){var t=e.get(n.type);t||(t=i(e,n)),n&&(n.directions&&(n.direction=a(n.directions)),t.set(n)),n.recognizeWith&&t.recognizeWith(n.recognizeWith),n.dropRecognizeWith&&t.dropRecognizeWith(n.dropRecognizeWith),n.requireFailure&&t.requireFailure(n.requireFailure),n.dropRequireFailure&&t.dropRequireFailure(n.dropRequireFailure)}function a(e){var i=0;return n.forEach(e.split("|"),function(e){t.hasOwnProperty(e)&&(i|=t[e])}),i}var r=["hmCustom:custom","hmSwipe:swipe","hmSwipeleft:swipeleft","hmSwiperight:swiperight","hmSwipeup:swipeup","hmSwipedown:swipedown","hmPan:pan","hmPanstart:panstart","hmPanmove:panmove","hmPanend:panend","hmPancancel:pancancel","hmPanleft:panleft","hmPanright:panright","hmPanup:panup","hmPandown:pandown","hmPress:press","hmRotate:rotate","hmRotatestart:rotatestart","hmRotatemove:rotatemove","hmRotateend:rotateend","hmRotatecancel:rotatecancel","hmPinch:pinch","hmPinchstart:pinchstart","hmPinchmove:pinchmove","hmPinchend:pinchend","hmPinchcancel:pinchcancel","hmPinchin:pinchin","hmPinchout:pinchout","hmTap:tap","hmDoubletap:doubletap"];n.module("hmTouchEvents",[]),n.forEach(r,function(e){var i=e.split(":"),a=i[0],r=i[1];n.module("hmTouchEvents").directive(a,["$parse","$window",function(e,i){return{restrict:"A",link:function(p,h,c){var d=c[a],m=e(d),s=function(e){var n=p.$root.$$phase,t=function(){m(p,{$event:e})};p[d]?p[d](e):"$apply"===n||"$digest"===n?t():p.$apply(t)},u=n.fromJson(c.hmManagerOptions),f=n.fromJson(c.hmRecognizerOptions),w=h.data("hammer");return t&&i.addEventListener?(w||(w=new t.Manager(h[0],u),h.data("hammer",w)),void("custom"===r?n.isArray(f)?n.forEach(f,function(e){o(w,e),w.on(e.event,s),p.$on("$destroy",function(){w.off(e.event,s)})}):n.isObject(f)&&(o(w,f),w.on(options.event,s),p.$on("$destroy",function(){w.off(options.event,s)})):(n.isArray(f)?n.forEach(f,function(e){r.indexOf(e.type)>-1&&o(w,e)}):n.isObject(f)&&r.indexOf(f.type)>-1?o(w,f):(f={type:r},f.type.indexOf("doubletap")>-1&&(f.event=f.type,f.taps=2,w.get("tap")&&(f.recognizeWith="tap")),f.type.indexOf("pan")>-1&&w.get("swipe")&&(f.recognizeWith="swipe"),f.type.indexOf("pinch")>-1&&w.get("rotate")&&(f.recognizeWith="rotate"),o(w,f)),w.on(r,s),p.$on("$destroy",function(){w.off(r,s)})))):("hmTap"===a&&h.bind("click",s),void("hmDoubleTap"===a&&h.bind("dblclick",s)))}}}])})}(window,window.angular,window.Hammer);