UNPKG

1.87 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || (function () {
2 var extendStatics = Object.setPrototypeOf ||
3 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5 return function (d, b) {
6 extendStatics(d, b);
7 function __() { this.constructor = d; }
8 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9 };
10})();
11import { GESTURE_PRIORITY_TOGGLE, GESTURE_TOGGLE } from '../../gestures/gesture-controller';
12import { PanGesture } from '../../gestures/pan-gesture';
13import { pointerCoord } from '../../util/dom';
14/**
15 * @hidden
16 */
17var ToggleGesture = (function (_super) {
18 __extends(ToggleGesture, _super);
19 function ToggleGesture(plt, toggle, gestureCtrl, domCtrl) {
20 var _this = _super.call(this, plt, toggle.getNativeElement(), {
21 threshold: 0,
22 zone: false,
23 domController: domCtrl,
24 gesture: gestureCtrl.createGesture({
25 name: GESTURE_TOGGLE,
26 priority: GESTURE_PRIORITY_TOGGLE
27 })
28 }) || this;
29 _this.toggle = toggle;
30 return _this;
31 }
32 ToggleGesture.prototype.canStart = function () {
33 return true;
34 };
35 ToggleGesture.prototype.onDragStart = function (ev) {
36 ev.preventDefault();
37 this.toggle._onDragStart(pointerCoord(ev).x);
38 };
39 ToggleGesture.prototype.onDragMove = function (ev) {
40 ev.preventDefault();
41 this.toggle._onDragMove(pointerCoord(ev).x);
42 };
43 ToggleGesture.prototype.onDragEnd = function (ev) {
44 ev.preventDefault();
45 this.toggle._onDragEnd(pointerCoord(ev).x);
46 };
47 return ToggleGesture;
48}(PanGesture));
49export { ToggleGesture };
50//# sourceMappingURL=toggle-gesture.js.map
\No newline at end of file