From 9005e2fda89b4fcf1cd99d412b6d23745141ca86 Mon Sep 17 00:00:00 2001 From: attila Date: Fri, 22 Jul 2022 11:15:18 +0200 Subject: [PATCH] Drawable: Fix clobbering Component transform when setDrawableTransform() isn't called --- modules/juce_gui_basics/drawables/juce_Drawable.cpp | 3 +++ modules/juce_gui_basics/drawables/juce_Drawable.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/juce_gui_basics/drawables/juce_Drawable.cpp b/modules/juce_gui_basics/drawables/juce_Drawable.cpp index 1a902e6a5d..0c5a3cc4d7 100644 --- a/modules/juce_gui_basics/drawables/juce_Drawable.cpp +++ b/modules/juce_gui_basics/drawables/juce_Drawable.cpp @@ -163,6 +163,9 @@ void Drawable::setDrawableTransform (const AffineTransform& transform) void Drawable::updateTransform() { + if (drawableTransform.isIdentity()) + return; + const auto transformationOrigin = originRelativeToComponent + getPosition(); setTransform (AffineTransform::translation (transformationOrigin * (-1)) .followedBy (drawableTransform) diff --git a/modules/juce_gui_basics/drawables/juce_Drawable.h b/modules/juce_gui_basics/drawables/juce_Drawable.h index 566c59be1a..6d3ca08184 100644 --- a/modules/juce_gui_basics/drawables/juce_Drawable.h +++ b/modules/juce_gui_basics/drawables/juce_Drawable.h @@ -195,6 +195,9 @@ public: Using setDrawableTransform() will take this internal offset into account when applying the transform to the Component base. + + You can only use Drawable::setDrawableTransform() or Component::setTransform() for a given + object. Using both will lead to unpredictable behaviour. */ void setDrawableTransform (const AffineTransform& transform);