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

Avoided some assertions drawing very small ToggleButtons

This commit is contained in:
jules 2017-08-07 10:40:25 +01:00
parent 0ca253856b
commit 3c43707a54
2 changed files with 4 additions and 8 deletions

View file

@ -336,11 +336,9 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button,
if (! button.isEnabled())
g.setOpacity (0.5f);
const int textX = (int) tickWidth + 5;
g.drawFittedText (button.getButtonText(),
textX, 0,
button.getWidth() - textX - 2, button.getHeight(),
button.getLocalBounds().withTrimmedLeft (roundToInt (tickWidth) + 5)
.withTrimmedRight (2),
Justification::centredLeft, 10);
}

View file

@ -333,11 +333,9 @@ void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button,
if (! button.isEnabled())
g.setOpacity (0.5f);
const auto textX = roundToInt (tickWidth) + 10;
g.drawFittedText (button.getButtonText(),
textX, 0,
button.getWidth() - textX - 2, button.getHeight(),
button.getLocalBounds().withTrimmedLeft (roundToInt (tickWidth) + 10)
.withTrimmedRight (2),
Justification::centredLeft, 10);
}