Force checkbox to be square.
This commit is contained in:
+5
-9
@@ -44,15 +44,11 @@ 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();
|
||||||
if (x < (rect.w >> 2))
|
_setValue(!getValue());
|
||||||
{
|
setFocus(SET_FOCUS_DEFAULT);
|
||||||
onKeyPress();
|
invalidate();
|
||||||
_setValue(!getValue());
|
|
||||||
setFocus(SET_FOCUS_DEFAULT);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ class CheckBox : public FormField {
|
|||||||
_getValue(std::move(getValue)),
|
_getValue(std::move(getValue)),
|
||||||
_setValue(std::move(setValue))
|
_setValue(std::move(setValue))
|
||||||
{
|
{
|
||||||
|
coord_t size = min(rect.w, rect.h);
|
||||||
|
setWidth(size);
|
||||||
|
setHeight(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
|
|||||||
Reference in New Issue
Block a user