Request: Evaluate isCommandDown() in Viewport::useMouseWheel


#1

Hi,

Currently, the Viewport::useMouseWheelMoveIfNeeded() method makes 2 checks to see if it should evaluate the mouse wheel move or not:

The problem is that it is not platform agnostic and doesn’t take into account the Command key on OSX.
Jules, could you replace it with:

?


#2

Cmd key != Ctrl key on mac, aren’t they ?


#3

Yes, but no application makes use of the Ctrl key:
Ctrl+click == right click (heritage of the one-button mice era), and Ctrl+mousewheel triggers system-level zooming for visually impaired users (or for when I forget my glasses :oops: ).

The equivalent of Windows Ctrl on Mac is Cmd for all the usual tasks: selecting several files, triggering drag-and-drop variants, etc.


#4

I actually can’t remember why I added those checks at all… Why should it ignore the mouse-wheel when those modifier keys are pressed? I guess I must have had a good reason to do that, but looking at it now, I can’t see why?


#5

Well, in my case, I want to scroll the viewport on mouse wheel with no modifiers, and apply a transformation on the content component (but not scroll it!) on mouse wheel with modifiers. So I just added a mouse listener to the viewport component instance to handle the zooming case, but then the default listener gets called since it’s next on the listenerList and my viewport is scrolled every time.

I don’t see any other obvious way to deal with this case right now. All the work-arounds I can think of are really ugly…


#6

Hmm. Yes, I guess I just did it to allow modifier-key wheel events through for people’s custom handlers. Ok, I’ll add the command key filter too then, there’s no reason not to.


#7

Thanks Jules!