Horizontal scrolling scrolls diagonally

If you have a mouse that can scroll horizontally with the scroll wheel, doing that will scroll to the side as expected but also scroll down at the same pace.

This is just generally annoying

does this for me too with my trackpad

Are you running some code that follows your mouse? Could you share it? Tnx.

Well, this is the code that processes the mouse scrolling

By using an autohotkey script to allow me to horizontal scroll, I can see what is happening.

I noticed that when I scrolled horizontally, I noticed this result

event.wheelDeltaY = 0
event.wheelDeltaX = 181
event.wheelDelta = 181

Just to be clear, event.wheelDelta is 181 (or -181) whichever way you scroll, it's not locked to one axes.

Snap uses event.wheelDelta as a failsafe if event.wheelDeltaY doesn't exist, or at least that's what it's trying to do. In practice, it's not actually working. For some reason Object.prototype.hasOwnProperty.call(event, 'wheelDeltaY') is returning false, which in turn is making snap use event.wheelDelta instead. The only solution that I can find is by using the in operator like this.

morph.mouseScroll(
    (event.detail / -3) || (
        'wheelDeltaY' in event ?
                event.wheelDeltaY / 120 :
                event.wheelDelta / 120
    ),
    event.wheelDeltaX / 120 || 0
);

I also checked the browser compatibility, and it looks really good.

Autohotkey script if anyone's curious

Hold shift to scroll horizontally.

+WheelDown::WheelRight
+WheelUp::WheelLeft

As a side note, it would be really nice if there was a way to horizontal scroll just by holding shift, like in any other program (including the web browser). The autohotkey script I used works, but that is an external script that I have to use an external program in order to run. Plus, not everyone has a mouse that can scroll horizontally.

Thanks for the bugfix! We'll see what Jens says about it.

Thanks. I'm not convinced, it works fine with several mice on both my Macs and PCs.

It may be the weird Object.prototype.hasOwnProperty.call(event, 'wheelDeltaY') behavior. For me, on windows 10 brave (chrome), it returns false, even though it should be true.