mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +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:
parent
c65df44eee
commit
ef9fd6c286
3 changed files with 4 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
|
||||
#include <LibCrypto/NumberTheory/ModularFunctions.h>
|
||||
|
||||
unsigned Keypad::type_digit(int digit)
|
||||
void Keypad::type_digit(int digit)
|
||||
{
|
||||
switch (m_state) {
|
||||
case State::External:
|
||||
|
@ -34,7 +34,6 @@ unsigned Keypad::type_digit(int digit)
|
|||
m_frac_length.set_to(m_frac_length.plus(1));
|
||||
break;
|
||||
}
|
||||
return m_frac_length.to_u64();
|
||||
}
|
||||
|
||||
void Keypad::type_decimal_point()
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
Keypad() = default;
|
||||
~Keypad() = default;
|
||||
|
||||
unsigned type_digit(int digit);
|
||||
void type_digit(int digit);
|
||||
void type_decimal_point();
|
||||
void type_backspace();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue