diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index f68eeab363..c61405bbd1 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -1257,7 +1257,7 @@ void Component::setBoundsRelative (const float x, const float y, roundToInt (h * ph)); } -void Component::setCentrePosition (Point p) { setBounds (getBounds().withCentre (p)); } +void Component::setCentrePosition (Point p) { setBounds (getBounds().withCentre (p.transformedBy (getTransform().inverted()))); } void Component::setCentrePosition (int x, int y) { setCentrePosition ({x, y}); } void Component::setCentreRelative (float x, float y) @@ -1268,7 +1268,8 @@ void Component::setCentreRelative (float x, float y) void Component::centreWithSize (const int width, const int height) { - auto parentArea = ComponentHelpers::getParentOrMainMonitorBounds (*this); + auto parentArea = ComponentHelpers::getParentOrMainMonitorBounds (*this) + .transformedBy (getTransform().inverted()); setBounds (parentArea.getCentreX() - width / 2, parentArea.getCentreY() - height / 2,