Component::mouseMagnify gets called with negative scaleFactor on OSX

There is a redirectMagnify in juce_mac_NSViewComponentPeer.mm that does:

const float invScale = 1.0f - (float) [ev magnification];
 

if [ev magnification] is large enough (which it is in my case), invScale and therefore scaleFactor passed to mouseMagnify will be negative.

 

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/occ/instm/NSEvent/magnification states:

The change in magnification that should be added to the current scaling of an item to achieve the new scale factor.

 

So apple want us to add those values, not multiply them. And the conversion done in redirectMagnify appears to be incorrect.

 

Any Ideas on how to solve this? Maybe just clamp the values, so that the API remains compatible to other platforms?

 

best
-- Benjamin

Thanks. I've added a safety check so that it won't break - can't really change the meaning of the values because that'd mess up existing code, but hopefully should be safe now.