aboutsummaryrefslogtreecommitdiff
path: root/point/libs/hammerjs
diff options
context:
space:
mode:
Diffstat (limited to 'point/libs/hammerjs')
-rw-r--r--point/libs/hammerjs/hammer.min.js313
-rw-r--r--point/libs/hammerjs/hammer.min.map1
2 files changed, 314 insertions, 0 deletions
diff --git a/point/libs/hammerjs/hammer.min.js b/point/libs/hammerjs/hammer.min.js
new file mode 100644
index 0000000..d7b2e9a
--- /dev/null
+++ b/point/libs/hammerjs/hammer.min.js
@@ -0,0 +1,313 @@
1/*! Hammer.JS - v1.1.3 - 2014-05-20
2 * http://eightmedia.github.io/hammer.js
3 *
4 * Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
5 * Licensed under the MIT license */
6
7
8!function (a, b) {
9 "use strict";
10 function c() {
11 d.READY || (s.determineEventTypes(), r.each(d.gestures, function (a) {
12 u.register(a)
13 }), s.onTouch(d.DOCUMENT, n, u.detect), s.onTouch(d.DOCUMENT, o, u.detect), d.READY = !0)
14 }
15
16 var d = function v(a, b) {
17 return new v.Instance(a, b || {})
18 };
19 d.VERSION = "1.1.3", d.defaults = {behavior: {userSelect: "none", touchAction: "pan-y", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)"}}, d.DOCUMENT = document, d.HAS_POINTEREVENTS = navigator.pointerEnabled || navigator.msPointerEnabled, d.HAS_TOUCHEVENTS = "ontouchstart"in a, d.IS_MOBILE = /mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent), d.NO_MOUSEEVENTS = d.HAS_TOUCHEVENTS && d.IS_MOBILE || d.HAS_POINTEREVENTS, d.CALCULATE_INTERVAL = 25;
20 var e = {}, f = d.DIRECTION_DOWN = "down", g = d.DIRECTION_LEFT = "left", h = d.DIRECTION_UP = "up", i = d.DIRECTION_RIGHT = "right", j = d.POINTER_MOUSE = "mouse", k = d.POINTER_TOUCH = "touch", l = d.POINTER_PEN = "pen", m = d.EVENT_START = "start", n = d.EVENT_MOVE = "move", o = d.EVENT_END = "end", p = d.EVENT_RELEASE = "release", q = d.EVENT_TOUCH = "touch";
21 d.READY = !1, d.plugins = d.plugins || {}, d.gestures = d.gestures || {};
22 var r = d.utils = {extend: function (a, c, d) {
23 for (var e in c)!c.hasOwnProperty(e) || a[e] !== b && d || (a[e] = c[e]);
24 return a
25 }, on: function (a, b, c) {
26 a.addEventListener(b, c, !1)
27 }, off: function (a, b, c) {
28 a.removeEventListener(b, c, !1)
29 }, each: function (a, c, d) {
30 var e, f;
31 if ("forEach"in a)a.forEach(c, d); else if (a.length !== b) {
32 for (e = 0, f = a.length; f > e; e++)if (c.call(d, a[e], e, a) === !1)return
33 } else for (e in a)if (a.hasOwnProperty(e) && c.call(d, a[e], e, a) === !1)return
34 }, inStr: function (a, b) {
35 return a.indexOf(b) > -1
36 }, inArray: function (a, b) {
37 if (a.indexOf) {
38 var c = a.indexOf(b);
39 return-1 === c ? !1 : c
40 }
41 for (var d = 0, e = a.length; e > d; d++)if (a[d] === b)return d;
42 return!1
43 }, toArray: function (a) {
44 return Array.prototype.slice.call(a, 0)
45 }, hasParent: function (a, b) {
46 for (; a;) {
47 if (a == b)return!0;
48 a = a.parentNode
49 }
50 return!1
51 }, getCenter: function (a) {
52 var b = [], c = [], d = [], e = [], f = Math.min, g = Math.max;
53 return 1 === a.length ? {pageX: a[0].pageX, pageY: a[0].pageY, clientX: a[0].clientX, clientY: a[0].clientY} : (r.each(a, function (a) {
54 b.push(a.pageX), c.push(a.pageY), d.push(a.clientX), e.push(a.clientY)
55 }), {pageX: (f.apply(Math, b) + g.apply(Math, b)) / 2, pageY: (f.apply(Math, c) + g.apply(Math, c)) / 2, clientX: (f.apply(Math, d) + g.apply(Math, d)) / 2, clientY: (f.apply(Math, e) + g.apply(Math, e)) / 2})
56 }, getVelocity: function (a, b, c) {
57 return{x: Math.abs(b / a) || 0, y: Math.abs(c / a) || 0}
58 }, getAngle: function (a, b) {
59 var c = b.clientX - a.clientX, d = b.clientY - a.clientY;
60 return 180 * Math.atan2(d, c) / Math.PI
61 }, getDirection: function (a, b) {
62 var c = Math.abs(a.clientX - b.clientX), d = Math.abs(a.clientY - b.clientY);
63 return c >= d ? a.clientX - b.clientX > 0 ? g : i : a.clientY - b.clientY > 0 ? h : f
64 }, getDistance: function (a, b) {
65 var c = b.clientX - a.clientX, d = b.clientY - a.clientY;
66 return Math.sqrt(c * c + d * d)
67 }, getScale: function (a, b) {
68 return a.length >= 2 && b.length >= 2 ? this.getDistance(b[0], b[1]) / this.getDistance(a[0], a[1]) : 1
69 }, getRotation: function (a, b) {
70 return a.length >= 2 && b.length >= 2 ? this.getAngle(b[1], b[0]) - this.getAngle(a[1], a[0]) : 0
71 }, isVertical: function (a) {
72 return a == h || a == f
73 }, setPrefixedCss: function (a, b, c, d) {
74 var e = ["", "Webkit", "Moz", "O", "ms"];
75 b = r.toCamelCase(b);
76 for (var f = 0; f < e.length; f++) {
77 var g = b;
78 if (e[f] && (g = e[f] + g.slice(0, 1).toUpperCase() + g.slice(1)), g in a.style) {
79 a.style[g] = (null == d || d) && c || "";
80 break
81 }
82 }
83 }, toggleBehavior: function (a, b, c) {
84 if (b && a && a.style) {
85 r.each(b, function (b, d) {
86 r.setPrefixedCss(a, d, b, c)
87 });
88 var d = c && function () {
89 return!1
90 };
91 "none" == b.userSelect && (a.onselectstart = d), "none" == b.userDrag && (a.ondragstart = d)
92 }
93 }, toCamelCase: function (a) {
94 return a.replace(/[_-]([a-z])/g, function (a) {
95 return a[1].toUpperCase()
96 })
97 }}, s = d.event = {preventMouseEvents: !1, started: !1, shouldDetect: !1, on: function (a, b, c, d) {
98 var e = b.split(" ");
99 r.each(e, function (b) {
100 r.on(a, b, c), d && d(b)
101 })
102 }, off: function (a, b, c, d) {
103 var e = b.split(" ");
104 r.each(e, function (b) {
105 r.off(a, b, c), d && d(b)
106 })
107 }, onTouch: function (a, b, c) {
108 var f = this, g = function (e) {
109 var g, h = e.type.toLowerCase(), i = d.HAS_POINTEREVENTS, j = r.inStr(h, "mouse");
110 j && f.preventMouseEvents || (j && b == m && 0 === e.button ? (f.preventMouseEvents = !1, f.shouldDetect = !0) : i && b == m ? f.shouldDetect = 1 === e.buttons || t.matchType(k, e) : j || b != m || (f.preventMouseEvents = !0, f.shouldDetect = !0), i && b != o && t.updatePointer(b, e), f.shouldDetect && (g = f.doDetect.call(f, e, b, a, c)), g == o && (f.preventMouseEvents = !1, f.shouldDetect = !1, t.reset()), i && b == o && t.updatePointer(b, e))
111 };
112 return this.on(a, e[b], g), g
113 }, doDetect: function (a, b, c, d) {
114 var e = this.getTouchList(a, b), f = e.length, g = b, h = e.trigger, i = f;
115 b == m ? h = q : b == o && (h = p, i = e.length - (a.changedTouches ? a.changedTouches.length : 1)), i > 0 && this.started && (g = n), this.started = !0;
116 var j = this.collectEventData(c, g, e, a);
117 return b != o && d.call(u, j), h && (j.changedLength = i, j.eventType = h, d.call(u, j), j.eventType = g, delete j.changedLength), g == o && (d.call(u, j), this.started = !1), g
118 }, determineEventTypes: function () {
119 var b;
120 return b = d.HAS_POINTEREVENTS ? a.PointerEvent ? ["pointerdown", "pointermove", "pointerup pointercancel lostpointercapture"] : ["MSPointerDown", "MSPointerMove", "MSPointerUp MSPointerCancel MSLostPointerCapture"] : d.NO_MOUSEEVENTS ? ["touchstart", "touchmove", "touchend touchcancel"] : ["touchstart mousedown", "touchmove mousemove", "touchend touchcancel mouseup"], e[m] = b[0], e[n] = b[1], e[o] = b[2], e
121 }, getTouchList: function (a, b) {
122 if (d.HAS_POINTEREVENTS)return t.getTouchList();
123 if (a.touches) {
124 if (b == n)return a.touches;
125 var c = [], e = [].concat(r.toArray(a.touches), r.toArray(a.changedTouches)), f = [];
126 return r.each(e, function (a) {
127 r.inArray(c, a.identifier) === !1 && f.push(a), c.push(a.identifier)
128 }), f
129 }
130 return a.identifier = 1, [a]
131 }, collectEventData: function (a, b, c, d) {
132 var e = k;
133 return r.inStr(d.type, "mouse") || t.matchType(j, d) ? e = j : t.matchType(l, d) && (e = l), {center: r.getCenter(c), timeStamp: Date.now(), target: d.target, touches: c, eventType: b, pointerType: e, srcEvent: d, preventDefault: function () {
134 var a = this.srcEvent;
135 a.preventManipulation && a.preventManipulation(), a.preventDefault && a.preventDefault()
136 }, stopPropagation: function () {
137 this.srcEvent.stopPropagation()
138 }, stopDetect: function () {
139 return u.stopDetect()
140 }}
141 }}, t = d.PointerEvent = {pointers: {}, getTouchList: function () {
142 var a = [];
143 return r.each(this.pointers, function (b) {
144 a.push(b)
145 }), a
146 }, updatePointer: function (a, b) {
147 a == o || a != o && 1 !== b.buttons ? delete this.pointers[b.pointerId] : (b.identifier = b.pointerId, this.pointers[b.pointerId] = b)
148 }, matchType: function (a, b) {
149 if (!b.pointerType)return!1;
150 var c = b.pointerType, d = {};
151 return d[j] = c === (b.MSPOINTER_TYPE_MOUSE || j), d[k] = c === (b.MSPOINTER_TYPE_TOUCH || k), d[l] = c === (b.MSPOINTER_TYPE_PEN || l), d[a]
152 }, reset: function () {
153 this.pointers = {}
154 }}, u = d.detection = {gestures: [], current: null, previous: null, stopped: !1, startDetect: function (a, b) {
155 this.current || (this.stopped = !1, this.current = {inst: a, startEvent: r.extend({}, b), lastEvent: !1, lastCalcEvent: !1, futureCalcEvent: !1, lastCalcData: {}, name: ""}, this.detect(b))
156 }, detect: function (a) {
157 if (this.current && !this.stopped) {
158 a = this.extendEventData(a);
159 var b = this.current.inst, c = b.options;
160 return r.each(this.gestures, function (d) {
161 !this.stopped && b.enabled && c[d.name] && d.handler.call(d, a, b)
162 }, this), this.current && (this.current.lastEvent = a), a.eventType == o && this.stopDetect(), a
163 }
164 }, stopDetect: function () {
165 this.previous = r.extend({}, this.current), this.current = null, this.stopped = !0
166 }, getCalculatedData: function (a, b, c, e, f) {
167 var g = this.current, h = !1, i = g.lastCalcEvent, j = g.lastCalcData;
168 i && a.timeStamp - i.timeStamp > d.CALCULATE_INTERVAL && (b = i.center, c = a.timeStamp - i.timeStamp, e = a.center.clientX - i.center.clientX, f = a.center.clientY - i.center.clientY, h = !0), (a.eventType == q || a.eventType == p) && (g.futureCalcEvent = a), (!g.lastCalcEvent || h) && (j.velocity = r.getVelocity(c, e, f), j.angle = r.getAngle(b, a.center), j.direction = r.getDirection(b, a.center), g.lastCalcEvent = g.futureCalcEvent || a, g.futureCalcEvent = a), a.velocityX = j.velocity.x, a.velocityY = j.velocity.y, a.interimAngle = j.angle, a.interimDirection = j.direction
169 }, extendEventData: function (a) {
170 var b = this.current, c = b.startEvent, d = b.lastEvent || c;
171 (a.eventType == q || a.eventType == p) && (c.touches = [], r.each(a.touches, function (a) {
172 c.touches.push({clientX: a.clientX, clientY: a.clientY})
173 }));
174 var e = a.timeStamp - c.timeStamp, f = a.center.clientX - c.center.clientX, g = a.center.clientY - c.center.clientY;
175 return this.getCalculatedData(a, d.center, e, f, g), r.extend(a, {startEvent: c, deltaTime: e, deltaX: f, deltaY: g, distance: r.getDistance(c.center, a.center), angle: r.getAngle(c.center, a.center), direction: r.getDirection(c.center, a.center), scale: r.getScale(c.touches, a.touches), rotation: r.getRotation(c.touches, a.touches)}), a
176 }, register: function (a) {
177 var c = a.defaults || {};
178 return c[a.name] === b && (c[a.name] = !0), r.extend(d.defaults, c, !0), a.index = a.index || 1e3, this.gestures.push(a), this.gestures.sort(function (a, b) {
179 return a.index < b.index ? -1 : a.index > b.index ? 1 : 0
180 }), this.gestures
181 }};
182 d.Instance = function (a, b) {
183 var e = this;
184 c(), this.element = a, this.enabled = !0, r.each(b, function (a, c) {
185 delete b[c], b[r.toCamelCase(c)] = a
186 }), this.options = r.extend(r.extend({}, d.defaults), b || {}), this.options.behavior && r.toggleBehavior(this.element, this.options.behavior, !0), this.eventStartHandler = s.onTouch(a, m, function (a) {
187 e.enabled && a.eventType == m ? u.startDetect(e, a) : a.eventType == q && u.detect(a)
188 }), this.eventHandlers = []
189 }, d.Instance.prototype = {on: function (a, b) {
190 var c = this;
191 return s.on(c.element, a, b, function (a) {
192 c.eventHandlers.push({gesture: a, handler: b})
193 }), c
194 }, off: function (a, b) {
195 var c = this;
196 return s.off(c.element, a, b, function (a) {
197 var d = r.inArray({gesture: a, handler: b});
198 d !== !1 && c.eventHandlers.splice(d, 1)
199 }), c
200 }, trigger: function (a, b) {
201 b || (b = {});