feat(keyboard): unify keyboard metrics across Base, Lyra and Lyra3Covers themes

This commit is contained in:
pablohc
2026-04-15 11:45:09 +02:00
committed by jpirnay
parent 7e32838a16
commit 7108fadd63
5 changed files with 22 additions and 15 deletions
+5 -4
View File
@@ -884,8 +884,8 @@ void BaseTheme::drawTextField(const GfxRenderer& renderer, Rect rect, const int
const int bracketHeight = lineHeight;
const int fieldLeft = rect.x + 10;
const int fieldRight = rect.x + rect.width - 15;
const int topY = rect.y;
const int bottomY = rect.y + rect.height + lineHeight;
const int topY = rect.y - 5;
const int bottomY = rect.y + rect.height + lineHeight + 5;
const int tickLen = bracketHeight / 2;
renderer.drawLine(fieldLeft, topY, fieldLeft, bottomY);
@@ -937,10 +937,11 @@ void BaseTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const ch
const int itemWidth = renderer.getTextWidth(fontId, label);
const int textX = rect.x + (rect.width - itemWidth) / 2;
const int textY = rect.y + (rect.height - renderer.getLineHeight(fontId)) / 2 + primaryOffset;
renderer.drawText(fontId, textX, textY, label, !isSelected);
if (hasSecondary) {
const int secWidth = renderer.getTextWidth(SMALL_FONT_ID, secondaryLabel);
renderer.drawText(SMALL_FONT_ID, rect.x + rect.width - secWidth - 1, rect.y - 3, secondaryLabel, !isSelected);
renderer.drawText(SMALL_FONT_ID, rect.x + rect.width - secWidth - 1, rect.y, secondaryLabel, !isSelected);
}
renderer.drawText(fontId, textX, textY, label, !isSelected);
}
+6 -4
View File
@@ -60,6 +60,7 @@ struct ThemeMetrics {
int keyboardKeyWidth;
int keyboardKeyHeight;
int keyboardKeySpacing;
int keyboardBottomKeyHeight;
int keyboardBottomKeySpacing;
bool keyboardBottomAligned;
bool keyboardCenteredText;
@@ -100,12 +101,13 @@ constexpr ThemeMetrics values = {.batteryWidth = 15,
.statusBarHorizontalMargin = 5,
.statusBarVerticalMargin = 19,
.keyboardKeyWidth = 22,
.keyboardKeyHeight = 30,
.keyboardKeySpacing = 10,
.keyboardBottomKeySpacing = 0,
.keyboardKeyHeight = 40,
.keyboardKeySpacing = 0,
.keyboardBottomKeyHeight = 35,
.keyboardBottomKeySpacing = 5,
.keyboardBottomAligned = true,
.keyboardCenteredText = false,
.keyboardVerticalOffset = -10};
.keyboardVerticalOffset = -13};
}
class BaseTheme {
@@ -34,12 +34,13 @@ constexpr ThemeMetrics values = {.batteryWidth = 16,
.statusBarHorizontalMargin = 5,
.statusBarVerticalMargin = 19,
.keyboardKeyWidth = 31,
.keyboardKeyHeight = 50,
.keyboardKeyHeight = 40,
.keyboardKeySpacing = 0,
.keyboardBottomKeyHeight = 35,
.keyboardBottomKeySpacing = 5,
.keyboardBottomAligned = true,
.keyboardCenteredText = true,
.keyboardVerticalOffset = 0};
.keyboardVerticalOffset = -7};
}
class Lyra3CoversTheme : public LyraTheme {
+2 -1
View File
@@ -34,10 +34,11 @@ constexpr ThemeMetrics values = {.batteryWidth = 16,
.keyboardKeyWidth = 31,
.keyboardKeyHeight = 40,
.keyboardKeySpacing = 0,
.keyboardBottomKeyHeight = 35,
.keyboardBottomKeySpacing = 5,
.keyboardBottomAligned = true,
.keyboardCenteredText = true,
.keyboardVerticalOffset = -12};
.keyboardVerticalOffset = -7};
}
class LyraTheme : public BaseTheme {