function PDFPresentationMode_mouseScroll(delta) {
      if (!this.active) {
        return;
      }
      var MOUSE_SCROLL_COOLDOWN_TIME = 50;
      var PAGE_SWITCH_THRESHOLD = 120;
      var PageSwitchDirection = {
        UP: -1,
        DOWN: 1
      };

      var currentTime = (new Date()).getTime();
      var storedTime = this.mouseScrollTimeStamp;

      // If we've already switched page, avoid accidentally switching again.
      if (currentTime > storedTime &&
          currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {
        return;
      }
      // If the scroll direction changed, reset the accumulated scroll delta.
      if ((this.mouseScrollDelta > 0 && delta < 0) ||
          (this.mouseScrollDelta < 0 && delta > 0)) {
        this._resetMouseScrollState();
      }
      this.mouseScrollDelta += delta;

      if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {
        var pageSwitchDirection = (this.mouseScrollDelta > 0) ?
          PageSwitchDirection.UP : PageSwitchDirection.DOWN;
        var page = this.pdfViewer.currentPageNumber;
        this._resetMouseScrollState();

        // If we're at the first/last page, we don't need to do anything.
        if ((page === 1 && pageSwitchDirection === PageSwitchDirection.UP) ||
            (page === this.pdfViewer.pagesCount &&
             pageSwitchDirection === PageSwitchDirection.DOWN)) {
          return;
        }
        this.pdfViewer.currentPageNumber = (page + pageSwitchDirection);
        this.mouseScrollTimeStamp = currentTime;
      }
    }
/**
     * Switches page when the user scrolls (using a scroll wheel or a touchpad)
     * with large enough motion, to prevent accidental page switches.
     * @param {number} delta - The delta value from the mouse event.
     */
Switches page when the user scrolls (using a scroll wheel or a touchpad)
with large enough motion, to prevent accidental page switches.
@param {number} delta - The delta value from the mouse event.
Switches page when the user scrolls ( using a scroll wheel or a touchpad ) with large enough motion to prevent accidental page switches . @param { number } delta - The delta value from the mouse event .
function PDFPresentationMode_mouseScroll(delta) {
      if (!this.active) {
        return;
      }
      var MOUSE_SCROLL_COOLDOWN_TIME = 50;
      var PAGE_SWITCH_THRESHOLD = 120;
      var PageSwitchDirection = {
        UP: -1,
        DOWN: 1
      };
      var currentTime = (new Date()).getTime();
      var storedTime = this.mouseScrollTimeStamp;
      if (currentTime > storedTime &&
          currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {
        return;
      }
      if ((this.mouseScrollDelta > 0 && delta < 0) ||
          (this.mouseScrollDelta < 0 && delta > 0)) {
        this._resetMouseScrollState();
      }
      this.mouseScrollDelta += delta;
      if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {
        var pageSwitchDirection = (this.mouseScrollDelta > 0) ?
          PageSwitchDirection.UP : PageSwitchDirection.DOWN;
        var page = this.pdfViewer.currentPageNumber;
        this._resetMouseScrollState();
        if ((page === 1 && pageSwitchDirection === PageSwitchDirection.UP) ||
            (page === this.pdfViewer.pagesCount &&
             pageSwitchDirection === PageSwitchDirection.DOWN)) {
          return;
        }
        this.pdfViewer.currentPageNumber = (page + pageSwitchDirection);
        this.mouseScrollTimeStamp = currentTime;
      }
    }
function PDFPresentationMode_mouseScroll ( delta ) { if ( ! this . active ) { return ; } var MOUSE_SCROLL_COOLDOWN_TIME = 50 ; var PAGE_SWITCH_THRESHOLD = 120 ; var PageSwitchDirection = { UP : - 1 , DOWN : 1 } ; var currentTime = ( new Date ( ) ) . getTime ( ) ; var storedTime = this . mouseScrollTimeStamp ; if ( currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME ) { return ; } if ( ( this . mouseScrollDelta > 0 && delta < 0 ) || ( this . mouseScrollDelta < 0 && delta > 0 ) ) { this . _resetMouseScrollState ( ) ; } this . mouseScrollDelta += delta ; if ( Math . abs ( this . mouseScrollDelta ) >= PAGE_SWITCH_THRESHOLD ) { var pageSwitchDirection = ( this . mouseScrollDelta > 0 ) ? PageSwitchDirection . UP : PageSwitchDirection . DOWN ; var page = this . pdfViewer . currentPageNumber ; this . _resetMouseScrollState ( ) ; if ( ( page === 1 && pageSwitchDirection === PageSwitchDirection . UP ) || ( page === this . pdfViewer . pagesCount && pageSwitchDirection === PageSwitchDirection . DOWN ) ) { return ; } this . pdfViewer . currentPageNumber = ( page + pageSwitchDirection ) ; this . mouseScrollTimeStamp = currentTime ; } }
Switches page when the user scrolls (using a scroll wheel or a touchpad)
 with large enough motion, to prevent accidental page switches.
Switches page when the user scrolls ( using a scroll wheel or a touchpad ) with large enough motion to prevent accidental page switches .
// If we've already switched page, avoid accidentally switching again. // If the scroll direction changed, reset the accumulated scroll delta. // If we're at the first/last page, we don't need to do anything.