Beispiel #1
0
 _updateSwipeable() {
   if (this._gestureDetector) {
     if (this.swipeable) {
       this._gestureDetector.on('drag dragleft dragright dragup dragdown swipe swipeleft swiperight swipeup swipedown', this._boundOnDrag);
       this._gestureDetector.on('dragend', this._boundOnDragEnd);
     } else {
       this._gestureDetector.off('drag dragleft dragright dragup dragdown swipe swipeleft swiperight swipeup swipedown', this._boundOnDrag);
       this._gestureDetector.off('dragend', this._boundOnDragEnd);
     }
   }
 }
Beispiel #2
0
  _createEventListeners() {
    this._gestureDetector = new GestureDetector(this._pageElement, {
      dragMinDistance: 1,
      dragDistanceCorrection: false
    });

    // Bind listeners
    this._gestureDetector.on('drag', this._boundOnDrag);
    this._gestureDetector.on('dragstart', this._boundOnDragStart);
    this._gestureDetector.on('dragend', this._boundOnDragEnd);

    this._scrollElement.parentElement.addEventListener('scroll', this._boundOnScroll, false);
  }