Issue with Drawable transforms

On each call to resized() in my editor class, I create an AffineTransform::scale and pass it to setDrawableTransform() on each Drawable child. Generally this works great for automatically resizing all the components and I don’t have to write anything in their paint() methods. (Note: the width / height proportion is fixed.)

However, if the scale is 1.0, meaning that the editor has been resized back to its original dimensions, then the components are no longer correctly sized. Here is a correctly sized knob:


And here is what it looks like if I resize larger and then bring it back down to the original scale:


After some investigation I found the culprit at line 166 of juce_Drawable.cpp in Drawable::updateTransform():

if (drawableTransform.isIdentity())

A scale transform of 1.0 is an identity transform, and because of the early return, the components aren’t getting resized to their original dimensions. Easy fix, right? I just commented out these two lines and everything was working as expected on my development machine (Linux) and on Mac.

However when I ported the change to Windows, I got all kinds of unexpected behavior (not pictured) that was only fixed by re-including the isIdentity guard in the JUCE source code.

I have been unable get my Drawable components to return to their original size on all platforms without getting weird artifacts, and ideally I shouldn’t have to alter the JUCE source code at all. Do I need to abandon the Drawable class and do everything manually in paint()? Maybe there’s something I’m missing. Any suggestions are welcome.