Closed Yanpas closed 5 years ago
A lot of errors appeared imediately and scrolling has become weird a little, but at least it works:
This isn't release ready. Before this commit function wheel wasn't even called (I was adding breakpoints to debugger)
Thank you for taking the time and adding this PR.
I strongly believe passive listeners aren't the way to go, because they are meant for listeners that do not change the scroll events.
The sole purpose of SmoothScroll is to
As you can see (1) is by definition about changing the scroll events.
That is why you receive the "preventDefault" inside passive listener error. In that case it is using a passive listener saying "hey I won't change anything inside this listener" and then trying to change things.
SmoothScroll doesn't directly detect Shift key scrolling.
https://github.com/gblazex/smoothscroll/blob/master/src/sscr.js#L343
It simply uses the deltaX properties of the wheel events.
It's the job of the OS to post deltaX instead of deltaY when the shift is down.
By placing a breakpoint at the line I just mentioned (343) you could check what deltaX and deltaY is when you are using the shift button.
deltax is 0, deltay is 120 no matter if i hold shift
okay test this patch added at line 364 https://github.com/gblazex/smoothscroll/blob/master/src/sscr.js#L364
var isLinux = /Linux/i.test(navigator.userAgent);
if (isLinux) { // issues #148 #176
var otherModifier = (event.ctrlKey || event.altKey || event.metaKey);
if (event.shiftKey && !otherModifier) {
deltaX = deltaX || deltaY;
deltaY = 0;
}
}
It works fine!
just uploaded the next version that fixes this. Peace man, Blaze
Thank you
Noticed this in console (verbose mode on):
Fixes #175