fix for #444: Accidentally altering a checkbox.

This commit is contained in:
eshifri
2021-07-19 15:17:31 -07:00
parent 4aade1d0da
commit b951dbf9de
+9 -5
View File
@@ -44,11 +44,15 @@ void CheckBox::onEvent(event_t event)
#if defined(HARDWARE_TOUCH) #if defined(HARDWARE_TOUCH)
bool CheckBox::onTouchEnd(coord_t x, coord_t y) bool CheckBox::onTouchEnd(coord_t x, coord_t y)
{ {
if (enabled) { if (enabled)
onKeyPress(); {
_setValue(!getValue()); if (x < (rect.w >> 2))
setFocus(SET_FOCUS_DEFAULT); {
invalidate(); onKeyPress();
_setValue(!getValue());
setFocus(SET_FOCUS_DEFAULT);
invalidate();
}
} }
return true; return true;
} }