mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 06:37:38 +03:00
ref: simplify confirm held for caps logic
This commit is contained in:
parent
1a34af2c87
commit
4462bfd5ef
@ -226,13 +226,12 @@ void KeyboardEntryActivity::loop() {
|
||||
}
|
||||
|
||||
// Selection
|
||||
if (mappedInput.isPressed(MappedInputManager::Button::Confirm) && mappedInput.getHeldTime() >= capsMs) {
|
||||
onCapsHeld();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm) && mappedInput.getHeldTime() < capsMs) {
|
||||
handleKeyPress();
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) {
|
||||
if (mappedInput.getHeldTime() >= capsMs) {
|
||||
shiftActive = !shiftActive;
|
||||
} else {
|
||||
handleKeyPress();
|
||||
}
|
||||
updateRequired = true;
|
||||
}
|
||||
|
||||
@ -358,13 +357,3 @@ void KeyboardEntryActivity::renderItemWithSelector(const int x, const int y, con
|
||||
}
|
||||
renderer.drawText(UI_10_FONT_ID, x, y, item);
|
||||
}
|
||||
|
||||
void KeyboardEntryActivity::onCapsHeld() {
|
||||
waitForCapsRelease();
|
||||
shiftActive = !shiftActive;
|
||||
updateRequired = true;
|
||||
}
|
||||
|
||||
void KeyboardEntryActivity::waitForCapsRelease() {
|
||||
while (mappedInput.isPressed(MappedInputManager::Button::Confirm)) delay(50);
|
||||
}
|
||||
|
||||
@ -96,7 +96,4 @@ class KeyboardEntryActivity : public Activity {
|
||||
int getRowLength(int row) const;
|
||||
void render() const;
|
||||
void renderItemWithSelector(int x, int y, const char* item, bool isSelected) const;
|
||||
|
||||
void onCapsHeld();
|
||||
void waitForCapsRelease();
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user