enhanced long touch to handle it without lifting finger. Now works exactly like other areas of system

This commit is contained in:
kkoenig1@optonline.com
2021-09-07 09:30:15 -04:00
parent 1ad865f08a
commit cb24ef9236
2 changed files with 27 additions and 2 deletions
+25 -2
View File
@@ -58,10 +58,33 @@ bool ChoiceEx::onTouchStart(coord_t x, coord_t y)
return Choice::onTouchStart(x, y);
}
bool ChoiceEx::onTouchEnd(coord_t x, coord_t y)
bool ChoiceEx::isLongPress()
{
tmr10ms_t curTimer = get_tmr10ms();
if (duration10ms != 0 && curTimer - duration10ms > LONG_PRESS_10MS) {
return (duration10ms != 0 && curTimer - duration10ms > LONG_PRESS_10MS);
}
void ChoiceEx::checkEvents(void)
{
event_t event = getEvent();
if (isLongPress()) {
if (longPressHandler) {
longPressHandler(event);
duration10ms = 0;
}
}
if (hasFocus())
onEvent(event);
else
pushEvent(event);
}
bool ChoiceEx::onTouchEnd(coord_t x, coord_t y)
{
if (isLongPress()) {
if (longPressHandler) {
longPressHandler(0);
duration10ms = 0;
+2
View File
@@ -33,6 +33,8 @@ class ChoiceEx : public Choice
#if defined(HARDWARE_TOUCH)
bool onTouchEnd(coord_t x, coord_t y) override;
bool onTouchStart(coord_t x, coord_t y) override;
void checkEvents(void) override;
bool isLongPress();
#endif
#if defined(DEBUG_WINDOWS)