aboutsummaryrefslogtreecommitdiff
path: root/scene/gui/scroll_container.h
diff options
context:
space:
mode:
authorRuslan Mustakov2018-02-27 22:37:20 +0700
committerRuslan Mustakov2018-04-09 20:34:52 +0700
commitdcf5be92a3aede861909c08d06b114669bbe75e8 (patch)
treed2ece25a54726772b644dc5d775fb327ebccafb0 /scene/gui/scroll_container.h
parent47676cfa98ffc49a8165b1453bc35a9d261e9c44 (diff)
downloadgodot-dcf5be92a3aede861909c08d06b114669bbe75e8.tar.gz
godot-dcf5be92a3aede861909c08d06b114669bbe75e8.tar.zst
godot-dcf5be92a3aede861909c08d06b114669bbe75e8.zip
Make BaseButton not emit press when container is scrolled
This fixes the problem described in #13996 in a proper way. This also adds "deadzone" property to ScrollContainer. It can be used on mobile, where taps are not as precise as mouse clicks. Player could slightly move their finger when tapping, in which case we still want the button to be pressed rather than the container to be scrolled.
Diffstat (limited to 'scene/gui/scroll_container.h')
-rw-r--r--scene/gui/scroll_container.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 6e3387918..3fe1ed447 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -56,10 +56,13 @@ class ScrollContainer : public Container {
bool drag_touching;
bool drag_touching_deaccel;
bool click_handled;
+ bool beyond_deadzone;
bool scroll_h;
bool scroll_v;
+ int deadzone;
+
void _cancel_drag();
protected:
@@ -86,6 +89,9 @@ public:
void set_enable_v_scroll(bool p_enable);
bool is_v_scroll_enabled() const;
+ int get_deadzone() const;
+ void set_deadzone(int p_deadzone);
+
virtual bool clips_input() const;
virtual String get_configuration_warning() const;