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 bottomRowGap = metrics.keyboardBottomKeySpacing > 0 ? 4 : 0;
|
||||||
const int bottomKeyWidth = 2 * keyWidth + keySpacing;
|
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);
|
const int bottomSelectedRow = isBottomRow(selectedRow);
|
||||||
|
|
||||||
struct BottomKeyInfo {
|
struct BottomKeyInfo {
|
||||||
@@ -267,7 +270,7 @@ void KeyboardEntryActivity::render(RenderLock&&) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < BOTTOM_KEY_COUNT; i++) {
|
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;
|
const bool isSelected = bottomSelectedRow && i == selectedCol;
|
||||||
|
|
||||||
GUI.drawKeyboardKey(renderer, Rect{keyX, bottomRowY, bottomKeyWidth, keyHeight}, bottomKeys[i].label, isSelected,
|
GUI.drawKeyboardKey(renderer, Rect{keyX, bottomRowY, bottomKeyWidth, keyHeight}, bottomKeys[i].label, isSelected,
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ struct ThemeMetrics {
|
|||||||
int keyboardKeyWidth;
|
int keyboardKeyWidth;
|
||||||
int keyboardKeyHeight;
|
int keyboardKeyHeight;
|
||||||
int keyboardKeySpacing;
|
int keyboardKeySpacing;
|
||||||
|
int keyboardBottomKeySpacing;
|
||||||
bool keyboardBottomAligned;
|
bool keyboardBottomAligned;
|
||||||
bool keyboardCenteredText;
|
bool keyboardCenteredText;
|
||||||
int keyboardVerticalOffset;
|
int keyboardVerticalOffset;
|
||||||
@@ -101,6 +102,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 15,
|
|||||||
.keyboardKeyWidth = 22,
|
.keyboardKeyWidth = 22,
|
||||||
.keyboardKeyHeight = 30,
|
.keyboardKeyHeight = 30,
|
||||||
.keyboardKeySpacing = 10,
|
.keyboardKeySpacing = 10,
|
||||||
|
.keyboardBottomKeySpacing = 0,
|
||||||
.keyboardBottomAligned = true,
|
.keyboardBottomAligned = true,
|
||||||
.keyboardCenteredText = false,
|
.keyboardCenteredText = false,
|
||||||
.keyboardVerticalOffset = -10};
|
.keyboardVerticalOffset = -10};
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 16,
|
|||||||
.keyboardKeyWidth = 31,
|
.keyboardKeyWidth = 31,
|
||||||
.keyboardKeyHeight = 50,
|
.keyboardKeyHeight = 50,
|
||||||
.keyboardKeySpacing = 0,
|
.keyboardKeySpacing = 0,
|
||||||
|
.keyboardBottomKeySpacing = 5,
|
||||||
.keyboardBottomAligned = true,
|
.keyboardBottomAligned = true,
|
||||||
.keyboardCenteredText = true,
|
.keyboardCenteredText = true,
|
||||||
.keyboardVerticalOffset = 0};
|
.keyboardVerticalOffset = 0};
|
||||||
|
|||||||
@@ -34,9 +34,10 @@ constexpr ThemeMetrics values = {.batteryWidth = 16,
|
|||||||
.keyboardKeyWidth = 31,
|
.keyboardKeyWidth = 31,
|
||||||
.keyboardKeyHeight = 40,
|
.keyboardKeyHeight = 40,
|
||||||
.keyboardKeySpacing = 0,
|
.keyboardKeySpacing = 0,
|
||||||
|
.keyboardBottomKeySpacing = 5,
|
||||||
.keyboardBottomAligned = true,
|
.keyboardBottomAligned = true,
|
||||||
.keyboardCenteredText = true,
|
.keyboardCenteredText = true,
|
||||||
.keyboardVerticalOffset = -10};
|
.keyboardVerticalOffset = -12};
|
||||||
}
|
}
|
||||||
|
|
||||||
class LyraTheme : public BaseTheme {
|
class LyraTheme : public BaseTheme {
|
||||||
|
|||||||
Reference in New Issue
Block a user