Mousewheel Support is Miscalculated #30

Closed
Radagaisus opened this Issue Sep 5, 2012 · 1 comment

2 participants

@Radagaisus

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.

@rauchg

Pull request?

@rauchg rauchg closed this in ace6299 Sep 6, 2012
@arlm arlm added a commit to arlm/antiscroll that referenced this issue Oct 31, 2012
@arlm arlm * recovering issue #30 bugfix 5504c58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment