stopDrag()

in client/src/components/translation-selector/word-scroll-list.ts [157:177]


  stopDrag() {
    if(!this.dragInfo) {
      return;
    }
    if(this.dragInfo.interval) {
      clearInterval(this.dragInfo.interval);
    }
    if (this.isDragging) {
      const velocity = this.dragInfo.velocityX;
      this.dragInfo = null;
      const snapWordIndex = this.getEndingSnapWordIndex(this.getScrollPosition(), velocity);
      this.scrollToWord(snapWordIndex, velocity);
      this.updateTargetPosition();
    } else {
      const wordIndex = this.getWordIndexFromPosition(this.dragInfo.lastClientX, this.dragInfo.lastClientY);
      this.dragInfo = null;
      if(wordIndex >= 0 && this._translations && wordIndex < this._translations.length) {
        this.scrollToWord(wordIndex);
      }
    }
  }