show long branch names (#1727)
This commit is contained in:
@@ -44,7 +44,6 @@ constexpr int cornerRadius = 6;
|
|||||||
constexpr int topHintButtonY = 345;
|
constexpr int topHintButtonY = 345;
|
||||||
constexpr int popupMarginX = 16;
|
constexpr int popupMarginX = 16;
|
||||||
constexpr int popupMarginY = 12;
|
constexpr int popupMarginY = 12;
|
||||||
constexpr int maxSubtitleWidth = 100;
|
|
||||||
constexpr int maxListValueWidth = 200;
|
constexpr int maxListValueWidth = 200;
|
||||||
constexpr int mainMenuIconSize = 32;
|
constexpr int mainMenuIconSize = 32;
|
||||||
constexpr int listIconSize = 24;
|
constexpr int listIconSize = 24;
|
||||||
@@ -307,8 +306,27 @@ void LyraTheme::drawHeader(const GfxRenderer& renderer, Rect rect, const char* t
|
|||||||
renderer.drawText(SMALL_FONT_ID, rect.x + LyraMetrics::values.contentSidePadding, rect.y + 5, clockStr);
|
renderer.drawText(SMALL_FONT_ID, rect.x + LyraMetrics::values.contentSidePadding, rect.y + 5, clockStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxTitleWidth =
|
int maxTitleWidth = title != nullptr ? renderer.getTextWidth(UI_12_FONT_ID, title, EpdFontFamily::BOLD) : 0;
|
||||||
rect.width - LyraMetrics::values.contentSidePadding * 2 - (subtitle != nullptr ? maxSubtitleWidth : 0);
|
int maxSubtitleWidth =
|
||||||
|
subtitle != nullptr ? renderer.getTextWidth(SMALL_FONT_ID, subtitle, EpdFontFamily::REGULAR) : 0;
|
||||||
|
|
||||||
|
// Available space is the distance between the side paddings, and a with side padding between title and subtitle.
|
||||||
|
const int availableSpace = rect.width - LyraMetrics::values.contentSidePadding * 3;
|
||||||
|
|
||||||
|
if (maxTitleWidth + maxSubtitleWidth > availableSpace) {
|
||||||
|
if ((maxTitleWidth > availableSpace / 2) && (maxSubtitleWidth > availableSpace / 2)) {
|
||||||
|
// Both are wider then half the space, truncate both.
|
||||||
|
maxTitleWidth = availableSpace / 2;
|
||||||
|
maxSubtitleWidth = availableSpace / 2;
|
||||||
|
} else {
|
||||||
|
// Truncate the the longest one
|
||||||
|
if (maxTitleWidth > maxSubtitleWidth) {
|
||||||
|
maxTitleWidth = availableSpace - maxSubtitleWidth;
|
||||||
|
} else {
|
||||||
|
maxSubtitleWidth = availableSpace - maxTitleWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
auto truncatedTitle = renderer.truncatedText(UI_12_FONT_ID, title, maxTitleWidth, EpdFontFamily::BOLD);
|
auto truncatedTitle = renderer.truncatedText(UI_12_FONT_ID, title, maxTitleWidth, EpdFontFamily::BOLD);
|
||||||
|
|||||||
Reference in New Issue
Block a user