Visual feedback improved
This commit is contained in:
@@ -136,6 +136,26 @@ void SwitchChoice::onEvent(event_t event)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
|
void SwitchChoice::checkEvents(void)
|
||||||
|
{
|
||||||
|
event_t event = getEvent();
|
||||||
|
|
||||||
|
if (duration10ms > 1) {
|
||||||
|
touchDuration10ms = get_tmr10ms() - duration10ms;
|
||||||
|
|
||||||
|
if (isLongPress()) {
|
||||||
|
int16_t val = getValue();
|
||||||
|
setValue(-val);
|
||||||
|
duration10ms = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasFocus())
|
||||||
|
onEvent(event);
|
||||||
|
else
|
||||||
|
pushEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
bool SwitchChoice::onTouchStart(coord_t x, coord_t y)
|
bool SwitchChoice::onTouchStart(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
if (!duration10ms) {
|
if (!duration10ms) {
|
||||||
@@ -148,12 +168,7 @@ bool SwitchChoice::onTouchEnd(coord_t x, coord_t y)
|
|||||||
{
|
{
|
||||||
setFocus(SET_FOCUS_DEFAULT);
|
setFocus(SET_FOCUS_DEFAULT);
|
||||||
|
|
||||||
touchDuration10ms = get_tmr10ms() - duration10ms;
|
|
||||||
duration10ms = 0;
|
duration10ms = 0;
|
||||||
if (isLongPress()) {
|
|
||||||
int16_t val = getValue();
|
|
||||||
setValue(-val);
|
|
||||||
}
|
|
||||||
|
|
||||||
setEditMode(true);
|
setEditMode(true);
|
||||||
openMenu();
|
openMenu();
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class SwitchChoice : public FormField
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
|
void checkEvents(void) override;
|
||||||
bool onTouchEnd(coord_t x, coord_t y) override;
|
bool onTouchEnd(coord_t x, coord_t y) override;
|
||||||
bool onTouchStart(coord_t x, coord_t y) override;
|
bool onTouchStart(coord_t x, coord_t y) override;
|
||||||
inline bool isLongPress(tmr10ms_t longPressDuration = LONG_PRESS_10MS)
|
inline bool isLongPress(tmr10ms_t longPressDuration = LONG_PRESS_10MS)
|
||||||
|
|||||||
Reference in New Issue
Block a user