enhanced long touch to handle it without lifting finger. Now works exactly like other areas of system
This commit is contained in:
@@ -58,10 +58,33 @@ bool ChoiceEx::onTouchStart(coord_t x, coord_t y)
|
|||||||
return Choice::onTouchStart(x, y);
|
return Choice::onTouchStart(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChoiceEx::onTouchEnd(coord_t x, coord_t y)
|
bool ChoiceEx::isLongPress()
|
||||||
{
|
{
|
||||||
tmr10ms_t curTimer = get_tmr10ms();
|
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) {
|
if (longPressHandler) {
|
||||||
longPressHandler(0);
|
longPressHandler(0);
|
||||||
duration10ms = 0;
|
duration10ms = 0;
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ class ChoiceEx : public Choice
|
|||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
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;
|
||||||
|
void checkEvents(void) override;
|
||||||
|
bool isLongPress();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
|
|||||||
Reference in New Issue
Block a user