edemaine / cocreate

Cocreate Shared Whiteboard/Drawing
MIT License
209 stars 27 forks source link

Convert Shift + 1D wheel into horizontal scroll (fix #131) #134

Closed edemaine closed 3 years ago

edemaine commented 3 years ago

This should fix #131. MacOS seems to do this conversion automatically (hence the deltaX == 0 check) but Windows doesn't, so we manually convert purely vertical wheel events into purely horizontal ones when shiftKey is set.

duetosymmetry commented 3 years ago

In https://github.com/edemaine/cocreate/issues/131#issuecomment-741971618, @edemaine asked:

Could you test PR #134 to make sure it doesn't break/change anything on the MacOS side, with regular wheeling, shift-wheel, ctrl-wheeling, and ctrl-shift-wheeling? (I imagine not, given the data you report above, but doesn't hurt to double-check.) On Windows, it now gives me the desired behavior: regular wheel is vertical, shift-wheel is horizontal, ctrl- and ctrl-shift-wheeling zooms.

I checked on MacOS with mouse wheel, in Chrome, Safari, and Firefox; and on a Chromebook with touchpad. In every browser, mouse wheel worked as expected with shift- and ctrl-. The combination of shift-ctrl-wheel does nothing. But, I think this doesn't matter too much — most people will only use wheel, shift-wheel, or ctrl-wheel. I think shift-ctrl-wheel is not an expected behavior.

edemaine commented 3 years ago

Sounds good — many thanks for testing!