UNPKG

ionic-framework

Version:

The ionic-framework package comes with both Javascript and Sass frontend dependencies, located in the root of the package, and a Node API, located in `tooling/`.

43 lines (42 loc) 1.53 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var gesture_1 = require('./gesture'); var util_1 = require('../util'); var DragGesture = (function (_super) { __extends(DragGesture, _super); function DragGesture(element, opts) { if (opts === void 0) { opts = {}; } util_1.defaults(opts, {}); _super.call(this, element, opts); } DragGesture.prototype.listen = function () { var _this = this; _super.prototype.listen.call(this); this.on('panstart', function (ev) { if (_this.onDragStart(ev) !== false) { _this.dragging = true; } }); this.on('panmove', function (ev) { if (!_this.dragging) return; if (_this.onDrag(ev) === false) { _this.dragging = false; } }); this.on('panend', function (ev) { if (!_this.dragging) return; _this.onDragEnd(ev); _this.dragging = false; }); }; DragGesture.prototype.onDrag = function (ev) { return true; }; DragGesture.prototype.onDragStart = function (ev) { return true; }; DragGesture.prototype.onDragEnd = function (ev) { }; return DragGesture; })(gesture_1.Gesture); exports.DragGesture = DragGesture;