Skip to content
This repository

Mousewheel Support is Miscalculated #30

Closed
Radagaisus opened this Issue · 1 comment

2 participants

Almog Melamed Guillermo Rauch
Almog Melamed

Hey,

On Mac OS X with Chrome there's a rounding error when trying to stop the window from scrolling when reaching the end of the antiscroll box.

> log y, this.innerEl.scrollTop, this.pane.el.height(), this.innerEl.scrollHeight
-0.025 585 299.77777767181396 885 

The mousewheel end detection is this:

if ((y > 0 && 0 == this.innerEl.scrollTop) ||
        (y < 0 && (this.innerEl.scrollTop + this.pane.el.height()
          == this.innerEl.scrollHeight))) {
      ev.preventDefault();
      return false;
    }

A simple fix for the rounding error:

((y > 0 && 0 == this.innerEl.scrollTop) ||
        (y < 0 && (1+this.innerEl.scrollTop + this.pane.el.height()
          >= this.innerEl.scrollHeight)))

or:

((y > 0 && 0 == this.innerEl.scrollTop) ||
        (y < 0 && (this.innerEl.scrollTop + Math.round(this.pane.el.height())
          >= this.innerEl.scrollHeight)))

This applies to both horizontal and vertical scroll.

Guillermo Rauch
Owner

Pull request?

Alexandre Rocha Lima e Marcondes arlm referenced this issue from a commit in arlm/antiscroll
Alexandre Rocha Lima e Marcondes arlm * recovering issue #30 bugfix 5504c58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.