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:

replace:

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

with:

        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

Thank you for reporting this. A fix has been released on develop

Hi Attila,

Your fix seems to be android only. I don’t remember exactly if I was using a touchscreen on windows, or an ios device when I reported the issue (I wrongly assumed it was not a platform specific issue, sorry), but it was not an android device. So it probably occurred on a windows touchscreen.

Can you say if you still experience the issue? I tested all platforms, but not Windows with a touch screen, but judging from the code I assumed it shouldn’t be presently affected.

The offscreenMousePos technique that was added to Android now to solve the issue, was already present on Windows touch handling.

I’ll check, but I’m pretty sure there are significant differences of behaviour of the touchscreen juce code for windows when compared to the iOS one. You should definitively get a touchscreen for windows at your offices.