a zip code crypto-currency system good for red ONLY

swipe-back.js 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. var __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. })();
  11. (function (factory) {
  12. if (typeof module === "object" && typeof module.exports === "object") {
  13. var v = factory(require, exports);
  14. if (v !== undefined) module.exports = v;
  15. }
  16. else if (typeof define === "function" && define.amd) {
  17. define(["require", "exports", "../util/util", "../gestures/gesture-controller", "../gestures/slide-edge-gesture"], factory);
  18. }
  19. })(function (require, exports) {
  20. "use strict";
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. var util_1 = require("../util/util");
  23. var gesture_controller_1 = require("../gestures/gesture-controller");
  24. var slide_edge_gesture_1 = require("../gestures/slide-edge-gesture");
  25. /**
  26. * @hidden
  27. */
  28. var SwipeBackGesture = (function (_super) {
  29. __extends(SwipeBackGesture, _super);
  30. function SwipeBackGesture(plt, _nav, gestureCtlr, domCtrl) {
  31. var _this = _super.call(this, plt, plt.doc().body, {
  32. direction: 'x',
  33. edge: 'start',
  34. maxEdgeStart: 75,
  35. threshold: 5,
  36. zone: false,
  37. domController: domCtrl,
  38. gesture: gestureCtlr.createGesture({
  39. name: gesture_controller_1.GESTURE_GO_BACK_SWIPE,
  40. priority: gesture_controller_1.GESTURE_PRIORITY_GO_BACK_SWIPE,
  41. disableScroll: true
  42. })
  43. }) || this;
  44. _this._nav = _nav;
  45. return _this;
  46. }
  47. SwipeBackGesture.prototype.canStart = function (ev) {
  48. // the gesture swipe angle must be mainly horizontal and the
  49. // gesture distance would be relatively short for a swipe back
  50. // and swipe back must be possible on this nav controller
  51. return (this._nav.canSwipeBack() &&
  52. _super.prototype.canStart.call(this, ev));
  53. };
  54. SwipeBackGesture.prototype.onSlideBeforeStart = function (_ev) {
  55. this._nav.swipeBackStart();
  56. };
  57. SwipeBackGesture.prototype.onSlide = function (slide, ev) {
  58. ev.preventDefault();
  59. ev.stopPropagation();
  60. var stepValue = (slide.distance / slide.max);
  61. this._nav.swipeBackProgress(stepValue);
  62. };
  63. SwipeBackGesture.prototype.onSlideEnd = function (slide, _ev) {
  64. var velocity = slide.velocity;
  65. var currentStepValue = (slide.distance / slide.max);
  66. var isResetDirecction = velocity < 0;
  67. var isMovingFast = Math.abs(slide.velocity) > 0.4;
  68. var isInResetZone = Math.abs(slide.delta) < Math.abs(slide.max) * 0.5;
  69. var shouldComplete = !util_1.swipeShouldReset(isResetDirecction, isMovingFast, isInResetZone);
  70. this._nav.swipeBackEnd(shouldComplete, currentStepValue, velocity);
  71. };
  72. return SwipeBackGesture;
  73. }(slide_edge_gesture_1.SlideEdgeGesture));
  74. exports.SwipeBackGesture = SwipeBackGesture;
  75. });
  76. //# sourceMappingURL=swipe-back.js.map