Button state update with touch events

Hi, when using a touchscreen to click on a button, the button state is updated twice:

Button::updateState(isover = true, isdown = true); // when the button mouseDown is called
Button::updateState(isover = true, isdown = false); // when mouseUp is called

So after the click, the button stays in the ‘isOver()’ state until there is another touch somewhere else. This does not seem like the best behaviour to me. So I suggest to make that change in the Button::mouseUp method:


        if (deletionWatcher != nullptr)
            updateState (isMouseSourceOver (e), false);


        if (deletionWatcher != nullptr)
            // on touch up there is not reason to consider that the finger is still 'over' the button.
            updateState (isMouseSourceOver (e) && !e.source.isTouch(), false);
1 Like