Make BaseButton not emit press when container is scrolled [2.1]

This fixes the problem described in #13996 in a proper way.
This also adds "deadzone" property to ScrollContainer.
It can be usedon mobile, where taps are not as precise as mouse clicks.
Player couldslightly move their finger when tapping, in which case we still wantthe button to be pressed rather than the container to be scrolled.
(cherry picked from commit dcf5be9)
This commit is contained in:
allkhor 2018-07-16 03:49:49 +06:00
parent 241ca9624e
commit 37c43154fe
5 changed files with 59 additions and 24 deletions

View file

@ -225,7 +225,7 @@ void BaseButton::_notification(int p_what) {
status.hovering = false;
update();
}
if (p_what == NOTIFICATION_DRAG_BEGIN) {
if (p_what == NOTIFICATION_DRAG_BEGIN || p_what == NOTIFICATION_SCROLL_BEGIN) {
if (status.press_attempt) {
status.press_attempt = false;