1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-24 01:54:22 +00:00

StandaloneFilterWindow: Avoid recursively resizing plugin editor

This commit is contained in:
reuk 2021-10-13 19:18:54 +01:00
parent cc2a563725
commit 718097fd60
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -904,9 +904,14 @@ private:
notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr)
editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat())
.withPosition (r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted()))
.toNearestInt());
{
const auto newPos = r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted());
if (preventResizingEditor)
editor->setTopLeftPosition (newPos.roundToInt());
else
editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat()).withPosition (newPos).toNearestInt());
}
}
private:
@ -1001,6 +1006,8 @@ private:
//==============================================================================
void componentMovedOrResized (Component&, bool, bool) override
{
const ScopedValueSetter<bool> scope (preventResizingEditor, true);
if (editor != nullptr)
{
auto rect = getSizeToContainEditor();
@ -1024,6 +1031,7 @@ private:
std::unique_ptr<AudioProcessorEditor> editor;
Value inputMutedValue;
bool shouldShowNotification = false;
bool preventResizingEditor = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};