fix(color): number edit keyboard is not sized to suit display, cursor position is wrong (#7670)

This commit is contained in:
philmoz
2026-08-25 12:37:30 +10:00
committed by GitHub
parent 7f6bbd1fb9
commit 298e6e6d32
2 changed files with 9 additions and 14 deletions
@@ -21,7 +21,7 @@
#include "numberedit.h" #include "numberedit.h"
#include "keys.h" #include "keys.h"
constexpr coord_t KEYBOARD_HEIGHT = 90; LAYOUT_VAL_SCALED(KEYBOARD_HEIGHT, 90);
NumberKeyboard* NumberKeyboard::_instance = nullptr; NumberKeyboard* NumberKeyboard::_instance = nullptr;
static const char* const number_kb_map[] = {"<<", "-", "+", ">>", "\n", static const char* const number_kb_map[] = {"<<", "-", "+", ">>", "\n",
@@ -72,42 +72,42 @@ void NumberKeyboard::handleEvent(const char* btn)
void NumberKeyboard::decLarge() void NumberKeyboard::decLarge()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_BACKWARD); field->onEvent(EVT_VIRTUAL_KEY_BACKWARD);
} }
void NumberKeyboard::decSmall() void NumberKeyboard::decSmall()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_MINUS); field->onEvent(EVT_VIRTUAL_KEY_MINUS);
} }
void NumberKeyboard::incSmall() void NumberKeyboard::incSmall()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_PLUS); field->onEvent(EVT_VIRTUAL_KEY_PLUS);
} }
void NumberKeyboard::incLarge() void NumberKeyboard::incLarge()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_FORWARD); field->onEvent(EVT_VIRTUAL_KEY_FORWARD);
} }
void NumberKeyboard::setMIN() void NumberKeyboard::setMIN()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_MIN); field->onEvent(EVT_VIRTUAL_KEY_MIN);
} }
void NumberKeyboard::setMAX() void NumberKeyboard::setMAX()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_MAX); field->onEvent(EVT_VIRTUAL_KEY_MAX);
} }
void NumberKeyboard::setDEF() void NumberKeyboard::setDEF()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_DEFAULT); field->onEvent(EVT_VIRTUAL_KEY_DEFAULT);
} }
void NumberKeyboard::changeSign() void NumberKeyboard::changeSign()
{ {
((NumberEdit*)field)->onEvent(EVT_VIRTUAL_KEY_SIGN); field->onEvent(EVT_VIRTUAL_KEY_SIGN);
} }
#if defined(HARDWARE_KEYS) #if defined(HARDWARE_KEYS)
@@ -35,11 +35,6 @@ class NumberArea : public FormField
{ {
setWindowFlag(NO_FOCUS); setWindowFlag(NO_FOCUS);
if (parent->getTextFlags() & CENTERED)
etx_obj_add_style(lvobj, styles->text_align_center, LV_PART_MAIN);
else
etx_obj_add_style(lvobj, styles->text_align_right, LV_PART_MAIN);
// Allow encoder acceleration // Allow encoder acceleration
lv_obj_add_flag(lvobj, LV_OBJ_FLAG_ENCODER_ACCEL); lv_obj_add_flag(lvobj, LV_OBJ_FLAG_ENCODER_ACCEL);