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

DemoRunner: Use Display::safeAreaInsets to position demo content

This commit is contained in:
ed 2021-02-04 19:21:57 +00:00
parent ac1425f94e
commit 78a09bdfc6

View file

@ -313,14 +313,21 @@ void MainComponent::paint (Graphics& g)
void MainComponent::resized()
{
auto bounds = getLocalBounds();
auto safeBounds = [this]
{
auto bounds = getLocalBounds();
showDemosButton.setBounds (0, 0, 150, contentComponent->getTabBarDepth());
if (auto* display = Desktop::getInstance().getDisplays().getDisplayForRect (getScreenBounds()))
return display->safeAreaInsets.subtractedFrom (bounds);
return bounds;
}();
showDemosButton.setBounds (safeBounds.getX(), safeBounds.getY(), 150, contentComponent->getTabBarDepth());
if (isShowingHeavyweightDemo)
{
bounds.removeFromLeft (sidePanelWidth);
safeBounds.removeFromLeft (sidePanelWidth);
contentComponent->setTabBarIndent (jmax (0, 150 - sidePanelWidth));
}
else
@ -328,7 +335,7 @@ void MainComponent::resized()
contentComponent->setTabBarIndent (150);
}
contentComponent->setBounds (bounds);
contentComponent->setBounds (safeBounds);
}
void MainComponent::homeButtonClicked()