FIX: SwitchButton auto scale font
Change-Id: If4004c0963cc8bb2f41e8e71c304d5239bf252ab Jira: STUDIO-4969 STUDIO-4921
This commit is contained in:
parent
2564c51b36
commit
818416d081
|
@ -82,6 +82,7 @@ void SwitchButton::Rescale()
|
|||
textSize[0] = dc.GetTextExtent(labels[0]);
|
||||
textSize[1] = dc.GetTextExtent(labels[1]);
|
||||
}
|
||||
float fontScale = 0;
|
||||
{
|
||||
thumbSize = textSize[0];
|
||||
auto size = textSize[1];
|
||||
|
@ -96,6 +97,7 @@ void SwitchButton::Rescale()
|
|||
maxWidth *= scale;
|
||||
#endif
|
||||
if (trackSize.x > maxWidth) {
|
||||
fontScale = float(maxWidth) / trackSize.x;
|
||||
thumbSize.x -= (trackSize.x - maxWidth) / 2;
|
||||
trackSize.x = maxWidth;
|
||||
}
|
||||
|
@ -115,6 +117,11 @@ void SwitchButton::Rescale()
|
|||
memdc.SelectObject(bmp);
|
||||
#endif
|
||||
memdc.SetFont(dc.GetFont());
|
||||
if (fontScale) {
|
||||
memdc.SetFont(dc.GetFont().Scaled(fontScale));
|
||||
textSize[0] = memdc.GetTextExtent(labels[0]);
|
||||
textSize[1] = memdc.GetTextExtent(labels[1]);
|
||||
}
|
||||
auto state = i == 0 ? StateColor::Enabled : (StateColor::Checked | StateColor::Enabled);
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
|
|
Loading…
Reference in New Issue