Make sliders honor the enable bool (#33)
This commit is contained in:
@@ -56,6 +56,9 @@ void Slider::onEvent(event_t event)
|
|||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool Slider::onTouchStart(coord_t x, coord_t y)
|
bool Slider::onTouchStart(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
|
if(!enabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!hasFocus()) {
|
if (!hasFocus()) {
|
||||||
onKeyPress();
|
onKeyPress();
|
||||||
setFocus(SET_FOCUS_DEFAULT);
|
setFocus(SET_FOCUS_DEFAULT);
|
||||||
@@ -66,6 +69,9 @@ bool Slider::onTouchStart(coord_t x, coord_t y)
|
|||||||
|
|
||||||
bool Slider::onTouchEnd(coord_t x, coord_t y)
|
bool Slider::onTouchEnd(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
|
if(!enabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
setValue(value(x));
|
setValue(value(x));
|
||||||
invalidate();
|
invalidate();
|
||||||
onKeyPress();
|
onKeyPress();
|
||||||
@@ -74,6 +80,9 @@ bool Slider::onTouchEnd(coord_t x, coord_t y)
|
|||||||
|
|
||||||
bool Slider::onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t startY, coord_t slideX, coord_t slideY)
|
bool Slider::onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t startY, coord_t slideX, coord_t slideY)
|
||||||
{
|
{
|
||||||
|
if(!enabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (hasFocus() && sliding) {
|
if (hasFocus() && sliding) {
|
||||||
int newValue = value(x);
|
int newValue = value(x);
|
||||||
if (getValue() != newValue) {
|
if (getValue() != newValue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user