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.
766831
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 = PDFViewerApplication.page;
        this._resetMouseScrollState();

        // If we're at the first/last page, we don't need to do anything.
        if ((page === 1 && pageSwitchDirection === PageSwitchDirection.UP) ||
            (page === PDFViewerApplication.pagesCount &&
             pageSwitchDirection === PageSwitchDirection.DOWN)) {
          return;
        }
        PDFViewerApplication.page = (page + pageSwitchDirection);
        this.mouseScrollTimeStamp = currentTime;
      }
    }
520277
function(event, delta) {
			var elem = (plugin.curInst && plugin.curInst.elem[0]) ||
				$(event.target).closest('.' + plugin._getMarker())[0];
			if (plugin.isDisabled(elem)) {
				return;
			}
			var inst = plugin._getInst(elem);
			if (inst.options.useMouseWheel) {
				delta = (delta < 0 ? -1 : +1);
				plugin.changeMonth(elem, -inst.options[event.ctrlKey ? 'monthsToJump' : 'monthsToStep'] * delta);
			}
			event.preventDefault();
		}
1250861
def keystroke_toggled(self, settings, key, user_data):
        
        for i in self.guake.notebook_manager.iter_terminals():
            i.set_scroll_on_keystroke(settings.get_boolean(key))
77013
def wheel(delta=1):
    
    location = get_position()
    e = Quartz.CGEventCreateMouseEvent(
        None,
        Quartz.kCGEventScrollWheel,
        location,
        Quartz.kCGMouseButtonLeft)
    e2 = Quartz.CGEventCreateScrollWheelEvent(
        None,
        Quartz.kCGScrollEventUnitLine,
        1,
        delta)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, e)
    Quartz.CGEventPost(Quartz.kCGHIDEventTap, e2)
919889
function (scrollBy, animation) {
            var pages = this.pages,
              pageCount = pages.length,
              currentPage = this.currentPage + scrollBy,
              clipHeight = this.clipHeight,
              navOptions = this.options.navigation,
              activeColor = navOptions.activeColor,
              inactiveColor = navOptions.inactiveColor,
              pager = this.pager,
              padding = this.padding,
              scrollOffset;

            // When resizing while looking at the last page
            if (currentPage > pageCount) {
                currentPage = pageCount;
            }

            if (currentPage > 0) {

                if (animation !== UNDEFINED) {
                    setAnimation(animation, this.chart);
                }

                this.nav.attr({
                    translateX: padding,
                    translateY: clipHeight + this.padding + 7 + this.titleHeight,
                    visibility: VISIBLE
                });
                this.up.attr({
                      fill: currentPage === 1 ? inactiveColor : activeColor
                  })
                  .css({
                      cursor: currentPage === 1 ? 'default' : 'pointer'
                  });
                pager.attr({
                    text: currentPage + '/' + pageCount
                });
                this.down.attr({
                      x: 18 + this.pager.getBBox().width, // adjust to text width
                      fill: currentPage === pageCount ? inactiveColor : activeColor
                  })
                  .css({
                      cursor: currentPage === pageCount ? 'default' : 'pointer'
                  });

                scrollOffset = -pages[currentPage - 1] + this.initialItemY;

                this.scrollGroup.animate({
                    translateY: scrollOffset
                });

                this.currentPage = currentPage;
                this.positionCheckboxes(scrollOffset);
            }

        }
437965
function scrollOnePage(element, downward) {

  // Determine the item visible just at the edge of direction we're heading.
  // We'll select that item if it's not already selected.
  const scrollTarget = element.scrollTarget;
  const edge = scrollTarget.scrollTop + (downward ? scrollTarget.clientHeight : 0);
  const indexOfItemAtEdge = getIndexOfItemAtY(element, edge, downward);

  const selectedIndex = element.selectedIndex;
  let newIndex;
  if (indexOfItemAtEdge && selectedIndex === indexOfItemAtEdge) {
    // The item at the edge was already selected, so scroll in the indicated
    // direction by one page. Leave the new item at that edge selected.
    const delta = (downward ? 1 : -1) * scrollTarget.clientHeight;
    newIndex = getIndexOfItemAtY(element, edge + delta, downward);
  }
  else {
    // The item at the edge wasn't selected yet. Instead of scrolling, we'll
    // just select that item. That is, the first attempt to page up/down
    // usually just moves the selection to the edge in that direction.
    newIndex = indexOfItemAtEdge;
  }

  if (!newIndex) {
    // We can't find an item in the direction we want to travel. Select the
    // last item (if moving downward) or first item (if moving upward).
    newIndex = (downward ? element.items.length - 1 : 0);
  }

  if (newIndex !== selectedIndex) {
    element.selectedIndex = newIndex;
    return true; // We handled the page up/down ourselves.
  }
  else {
    return false; // We didn't do anything.
  }
}
431620
function () {
            // Scroll or window resize
            $(window).on('resize scrollstop', _updateBoxes);

            // User entry
            $('input[type="number"]').on('keyup change click', events.onBoundaryChange); // 'click' is for spinners on input[number] control
            // Boundary toggle
            $showBoundsCheck.on('change', events.onBoundaryToggle);

            // Nudge controls
            // Only certain combinations of browsers/OSes allow capturing arrow key strokes, unfortunately
            // Windows: Firefox, Trident, Safari, Opera; Mac: Chrome, Safari, Opera; Not Firefox
            if ((navigator.oscpu && /Windows/.test(navigator.oscpu) && /Firefox|Trident|Safari|Presto/.test(navigator.userAgent)) || (/Macintosh/.test(navigator.userAgent) && /Chrome|Safari|Presto/.test(navigator.userAgent))) {
                $('#thresholds p').show();
                $('body').on('keydown', events.onNudge);
            }

            // Controls toggler
            $('#toggler').on('click', events.onControlsToggle);
        }
383209
function onScroll(cb) {
  var isTicking = false;
  var scrollY = 0;
  var body = document.body;
  var html = document.documentElement;
  var scrollHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
  function scroll() {
    scrollY = window.scrollY;
    if (cb) cb(scrollY, scrollHeight);
    requestTick();
  }
  function requestTick() {
    if (!isTicking) requestAnimationFrame(updateScroll);
    isTicking = true;
  }
  function updateScroll() {
    isTicking = false;
    var currentScrollY = scrollY;
  }
  scroll();
  window.onscroll = scroll;
}
809635
public boolean onScrollWheel(int delta)
	{
		if (!isEnabled())
			return false;

		for (IControlComponent c : controlComponents)
			if (c.onScrollWheel(delta))
				return true;

		return parent != null && !(this instanceof IControlComponent) ? parent.onScrollWheel(delta) : false;
	}
771207
function (position, endLocation, animationInterval) {
			var currentLocation = window.pageYOffset;
			if ( position == endLocation || currentLocation == endLocation || ( (window.innerHeight + currentLocation) >= documentHeight ) ) {
				clearInterval(animationInterval);
				options.callbackAfter( toggle, anchor ); // Run callbacks after animation complete
			}
		}
426442
function(e) {
    this.touch.cur = 'dragging';
    var delta = 0;
    if (this.touch.lastY && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
      //tilt
      delta = e.gesture.deltaY - this.touch.lastY;
      this.angleX += delta;
    } else if (this.touch.lastX && (e.gesture.direction == 'left' || e.gesture.direction == 'right')) {
      //pan
      delta = e.gesture.deltaX - this.touch.lastX;
      this.angleZ += delta;
    }
    if (delta)
      this.onDraw();
    this.touch.lastX = e.gesture.deltaX;
    this.touch.lastY = e.gesture.deltaY;
  }
651266
function moveHighlight(dropdown, delta) {
        var results = dropdown.results;
        if (!results.length) {
            return;
        }

        var resultItems = [].slice.call(dropdown.el.querySelectorAll('.selectivity-result-item'));

        function scrollToHighlight() {
            var el;
            if (dropdown.highlightedResult) {
                el = findResultItem(resultItems, dropdown.highlightedResult.id);
            } else if (dropdown.loadMoreHighlighted) {
                el = dropdown.$('.selectivity-load-more');
            }

            if (el && el.scrollIntoView) {
                el.scrollIntoView(delta < 0);
            }
        }

        if (dropdown.submenu) {
            moveHighlight(dropdown.submenu, delta);
            return;
        }

        var defaultIndex = delta > 0 ? 0 : resultItems.length - 1;
        var index = defaultIndex;
        var highlightedResult = dropdown.highlightedResult;
        if (highlightedResult) {
            var highlightedResultItem = findResultItem(resultItems, highlightedResult.id);
            index = resultItems.indexOf(highlightedResultItem) + delta;
            if (delta > 0 ? index >= resultItems.length : index < 0) {
                if (dropdown.hasMore) {
                    dropdown.highlightLoadMore();
                    scrollToHighlight();
                    return;
                } else {
                    index = defaultIndex;
                }
            }
        }

        var resultItem = resultItems[index];
        var result = Selectivity.findNestedById(results, selectivity.getRelatedItemId(resultItem));
        if (result) {
            dropdown.highlight(result, { delay: !!result.submenu });
            scrollToHighlight();
        }
    }
789830
function wheelDelta(ev) {
  // Only Firefox seems to use the line unit (which we assume to
  // be 25px), otherwise the delta is already measured in pixels.
  const unitInPixels = ev.deltaMode === DOM_DELTA_LINE ? 25 : 1;
  return -ev.deltaY * unitInPixels * ZOOM_SENSITIVITY;
}
1033161
function(oEvent) {
			// For interaction detection.
			Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);

			if (internal(this).bIsScrolledVerticallyByKeyboard) {
				// When scrolling with the keyboard the first visible row is already correct and does not need adjustment.
				log("Vertical scroll event handler: Aborted - Scrolled by keyboard", this);
				return;
			}

			// Do not scroll in action mode, if scrolling was not initiated by a keyboard action!
			// Might cause loss of user input and other undesired behavior.
			this._getKeyboardExtension().setActionMode(false);

			var nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome.
			var nOldScrollTop = oEvent.target._scrollTop; // This will be set in VerticalScrollingHelper#updateScrollPosition.
			var bScrollWithScrollbar = nNewScrollTop !== nOldScrollTop;

			if (bScrollWithScrollbar) {
				log("Vertical scroll event handler: Scroll position changed by scrolling with the scrollbar:"
					+ " From " + internal(this).nVerticalScrollPosition + " to " + nNewScrollTop, this);
				delete oEvent.target._scrollTop;
				VerticalScrollingHelper.updateScrollPosition(this, nNewScrollTop, ScrollTrigger.SCROLLBAR);
			} else {
				log("Vertical scroll event handler: Scroll position changed by scrolling with VerticalScrollingHelper#updateScrollPosition", this);
			}

			internal(this).bIsScrolledVerticallyByWheel = false;
		}
341312
function onScroll() {
		// unique tick id
		++ticks;

		// viewport rectangle
		var top = jWindow.scrollTop(),
			left = jWindow.scrollLeft(),
			right = left + jWindow.width(),
			bottom = top + jWindow.height();

		// determine which elements are in view
//        + 60 accounts for fixed nav
		var intersections = findElements(top+offset.top + 200, right+offset.right, bottom+offset.bottom, left+offset.left);
		$.each(intersections, function(i, element) {

			var lastTick = element.data('scrollSpy:ticks');
			if (typeof lastTick != 'number') {
				// entered into view
				element.triggerHandler('scrollSpy:enter');
			}

			// update tick id
			element.data('scrollSpy:ticks', ticks);
		});

		// determine which elements are no longer in view
		$.each(elementsInView, function(i, element) {
			var lastTick = element.data('scrollSpy:ticks');
			if (typeof lastTick == 'number' && lastTick !== ticks) {
				// exited from view
				element.triggerHandler('scrollSpy:exit');
				element.data('scrollSpy:ticks', null);
			}
		});

		// remember elements in view for next tick
		elementsInView = intersections;
	}
1036320
function smoothScroll() {

	if (window.addEventListener)
		window.addEventListener('DOMMouseScroll', wheel, false);

	window.onmousewheel = document.onmousewheel = wheel;

	var hb = {
		sTop: 0,
		sDelta: 0
	};

	function wheel(event) {

		var distance = jQuery.browser.webkit ? 60 : 120;
		if (event.wheelDelta)
			delta = event.wheelDelta / 120;
		else if (event.detail)
			delta = -event.detail / 3;

		hb.sTop = jQuery(window).scrollTop();
		hb.sDelta = hb.sDelta + delta * distance;

		jQuery(hb).stop().animate({
			sTop: jQuery(window).scrollTop() - hb.sDelta,
			sDelta: 0
		}, {
			duration: 200,
			easing: 'linear',
			step: function(now, ex) {
				if (ex.prop == 'sTop') jQuery('html, body').scrollTop(now)
			},
		});

		if (event.preventDefault)
			event.preventDefault();

		event.returnValue = false
	}

}
633972
def change_scroll(self, position):
        

        self.stream.write(self.hide_cursor)
        self.stream.write(self.csr(0, position))
        self.stream.write(self.move(position, 0))