1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +00:00

Calculator: Fix which digits get animated when pressing keyboard keys

Previously every digit press would appear like "0" was pressed on the
keypad.
This commit is contained in:
Karol Baraniecki 2022-12-26 17:07:00 +01:00 committed by Andreas Kling
parent c65df44eee
commit ef9fd6c286
3 changed files with 4 additions and 4 deletions

View file

@ -159,7 +159,8 @@ void CalculatorWidget::keydown_event(GUI::KeyEvent& event)
m_keypad.set_value(m_calculator.finish_operation(m_keypad.value()));
mimic_pressed_button(m_equals_button);
} else if (event.code_point() >= '0' && event.code_point() <= '9') {
auto const digit = m_keypad.type_digit(event.code_point() - '0');
auto const digit = event.code_point() - '0';
m_keypad.type_digit(digit);
mimic_pressed_button(m_digit_button[digit]);
} else if (event.code_point() == '.') {
m_keypad.type_decimal_point();