Scroll inertia


#1

Hi Jules,

 

Recent versions of macos provide scroll "momentum" ,  fake scroll events that are sent *after* the scroll gesture has ended. For now, JUCE receives those events just like regular scroll events and sends them to the component that is under the mouse pointer at the moment the event is received. The correct behaviour , in my opinion, would be to send those fake events to the component that was under the cursor when the last real scroll event was received.

Also it may be useful to add a flag for those events in the MouseWheelDetails struct, just like the 'isSmooth' bool.

For now, I'm simply discarding those inertial events in NSViewComponentPeer::redirectMouseWheel because they cause too much trouble on windows filled with many sliders:

 

            if ([ev respondsToSelector: @selector (deviceDeltaX)])
            {
                wheel.deltaX = checkDeviceDeltaReturnValue ((float) objc_msgSend_fpret (ev, @selector (deviceDeltaX)));
                wheel.deltaY = checkDeviceDeltaReturnValue ((float) objc_msgSend_fpret (ev, @selector (deviceDeltaY)));
            }

            + if ([ev respondsToSelector: @selector (momentumPhase)]) 
            + {
            +    if ([ev momentumPhase] != 0 /*NSEventPhaseNone*/) return;
            + }