Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using both mouse wheel and trackpad gives inconsistent results #1

Open
r3mi opened this issue May 27, 2014 · 17 comments
Open

using both mouse wheel and trackpad gives inconsistent results #1

r3mi opened this issue May 27, 2014 · 17 comments

Comments

@r3mi
Copy link

r3mi commented May 27, 2014

Mixing both mouse wheel and trackpad gives inconsistent results.
On the demo page, on rectangle #2:

  1. scroll using mouse wheel -> gives small deltas, +/- 1 for one wheel movement
  2. then switching to trackpad (two fingers scrolling on mac) -> gives also small deltas when going slowly
  3. switching back to mouse wheel -> deltas are now +/- 40

Mac OS X, chrome 35

@monospaced
Copy link
Owner

I'm not able to recreate this using a Macbook Air trackpad and Apple Mouse with Scroll Ball.

The delta is relative to the speed of scrolling, but if I'm careful to keep the speed slow, I'm able to switch from my trackpad to the mouse and back again, whilst retaining +/-1 deltas.

Also in Mac OS X (10.8.5), Chrome 35.

I wonder if the type of mouse (or other hardware variations) makes a difference?

@r3mi
Copy link
Author

r3mi commented May 29, 2014

Thanks for having a look.
May be related to mouse differences : I am using a non-mac scroll mouse (PC stuff, lenovo).
On the other hand, I don't have this issue with jquery-mousewheel (I noticed the issue while converting a project from jQuery to Angular/jqLite).

@monospaced
Copy link
Owner

OK, I've got a PC mouse at home, will check it out and get back to you.

@monospaced
Copy link
Owner

I finally got some time in the home office, and can recreate this issue exactly as described with a Dell mouse. Will investigate further.

@r3mi
Copy link
Author

r3mi commented Jun 12, 2014

Thanks

@juanpujol
Copy link

Any news on this? Thank you 👍

@monospaced
Copy link
Owner

Sorry for the lack of progress on this, I'm on hols at the moment, will be back in a week or 2.

@monospaced
Copy link
Owner

So it appears that jquery-mousewheel had the same issue, resolved in their 3.1.6 branch. This was a breaking change in their API, from 'event.delta, event.deltaX, event.deltaY' to 'event.deltaX, event.deltaY, event.deltaFactor'. The deltaFactor property accounts for the different scrolling speed/resolutions which are manifest in this issue.

So the task here is to port the latest delta normalisation code from the current stable version of jquery.mousewheel to hamster.js.

@andyperlitch
Copy link

+1

@DavidBM
Copy link

DavidBM commented Mar 25, 2015

What is the state of this issue?

@riston
Copy link

riston commented May 12, 2015

Hello, seems there has been no progress with issue. I am having some problems with wheelevent in the latest Firefox versions, also seems to be issue in IE 11.

The problems seems to be with the deltaY, which is not set in the event object. Adding the deltaY value to object is not full solution https://github.com/monospaced/hamster.js/blob/master/hamster.js#L211.

Hamster(el).wheel(function(event){
  console.log(event.deltaY);
});

@lolmaus
Copy link

lolmaus commented Jul 27, 2015

Ran into this issue too.

@lolmaus
Copy link

lolmaus commented Jul 27, 2015

Ok, my problem is Safari's inertial scrolling. You do an instant touch gesture, and Safari keeps emitting scroll events for over 800 milliseconds. Total bummer! :(

I ended up conditionally throttling the callback: 1s for Safari, 100ms for non-Safari.

@AoDev
Copy link

AoDev commented Feb 26, 2016

Same issue here. A mouse on OSX would make the scroll super slow while using the trackpad works fine.

@szkrd
Copy link

szkrd commented Mar 23, 2016

I do have the same issue with jquery-mousewheel. If I just use the event.deltaY this is absolutely the same; if I use event.deltaY * event.deltaFactor then it's much better with the mouse, but not really smooth (and at times really jerky even) with the touchpad. Probably I'm better off using overflow-y magic, but I just wanted to say that jquery-mousewheel didn't really help here.

@qrpike
Copy link

qrpike commented Aug 25, 2016

Still having this issue. How do we normalize this?

@AoDev
Copy link

AoDev commented Aug 25, 2016

@qrpike
Don't want to look like a bad guy, but I'd forget about this module as it is not really maintained.
I suggest you check the algorithm proposed by Mozilla, here, that's how I could solve the problem:
https://developer.mozilla.org/en-US/docs/Web/Events/wheel#Listening_to_this_event_across_browser

You have to check the deltaMode, for example like this.

const deltaY = event.deltaMode === 1
   ? -event.deltaY * 18
    : -event.deltaY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants