feat(keyboard): add bottom row spacing, vertical offset, and gap adjustments
This commit is contained in:
@@ -249,8 +249,11 @@ void KeyboardEntryActivity::render(RenderLock&&) {
|
||||
}
|
||||
}
|
||||
|
||||
const int bottomRowY = keyboardStartY + contentRows * (keyHeight + keySpacing);
|
||||
const int bottomKeyWidth = 2 * keyWidth + keySpacing;
|
||||
const int bottomRowGap = metrics.keyboardBottomKeySpacing > 0 ? 4 : 0;
|
||||
const int bottomRowY = keyboardStartY + contentRows * (keyHeight + keySpacing) + bottomRowGap;
|
||||
const int bkSpacing = metrics.keyboardBottomKeySpacing;
|
||||
const int contentTotalWidth = COLS * keyWidth + (COLS - 1) * keySpacing;
|
||||
const int bottomKeyWidth = (contentTotalWidth - (BOTTOM_KEY_COUNT - 1) * bkSpacing) / BOTTOM_KEY_COUNT;
|
||||
const int bottomSelectedRow = isBottomRow(selectedRow);
|
||||
|
||||
struct BottomKeyInfo {
|
||||
@@ -267,7 +270,7 @@ void KeyboardEntryActivity::render(RenderLock&&) {
|
||||
};
|
||||
|
||||
for (int i = 0; i < BOTTOM_KEY_COUNT; i++) {
|
||||
const int keyX = leftMargin + (2 * i) * (keyWidth + keySpacing);
|
||||
const int keyX = leftMargin + i * (bottomKeyWidth + bkSpacing);
|
||||
const bool isSelected = bottomSelectedRow && i == selectedCol;
|
||||
|
||||
GUI.drawKeyboardKey(renderer, Rect{keyX, bottomRowY, bottomKeyWidth, keyHeight}, bottomKeys[i].label, isSelected,
|
||||
|
||||
@@ -60,6 +60,7 @@ struct ThemeMetrics {
|
||||
int keyboardKeyWidth;
|
||||
int keyboardKeyHeight;
|
||||
int keyboardKeySpacing;
|
||||
int keyboardBottomKeySpacing;
|
||||
bool keyboardBottomAligned;
|
||||
bool keyboardCenteredText;
|
||||
int keyboardVerticalOffset;
|
||||
@@ -101,6 +102,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 15,
|
||||
.keyboardKeyWidth = 22,
|
||||
.keyboardKeyHeight = 30,
|
||||
.keyboardKeySpacing = 10,
|
||||
.keyboardBottomKeySpacing = 0,
|
||||
.keyboardBottomAligned = true,
|
||||
.keyboardCenteredText = false,
|
||||
.keyboardVerticalOffset = -10};
|
||||
|
||||
@@ -36,6 +36,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 16,
|
||||
.keyboardKeyWidth = 31,
|
||||
.keyboardKeyHeight = 50,
|
||||
.keyboardKeySpacing = 0,
|
||||
.keyboardBottomKeySpacing = 5,
|
||||
.keyboardBottomAligned = true,
|
||||
.keyboardCenteredText = true,
|
||||
.keyboardVerticalOffset = 0};
|
||||
|
||||
@@ -34,9 +34,10 @@ constexpr ThemeMetrics values = {.batteryWidth = 16,
|
||||
.keyboardKeyWidth = 31,
|
||||
.keyboardKeyHeight = 40,
|
||||
.keyboardKeySpacing = 0,
|
||||
.keyboardBottomKeySpacing = 5,
|
||||
.keyboardBottomAligned = true,
|
||||
.keyboardCenteredText = true,
|
||||
.keyboardVerticalOffset = -10};
|
||||
.keyboardVerticalOffset = -12};
|
||||
}
|
||||
|
||||
class LyraTheme : public BaseTheme {
|
||||
|
||||
Reference in New Issue
Block a user