summaryrefslogtreecommitdiff
path: root/scene/gui/scroll_bar.cpp
diff options
context:
space:
mode:
authorDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-02-19 20:12:07 +0100
committerDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-06-03 19:55:27 +0200
commit8f11a91917bc85976390477712dc4202ab383fe7 (patch)
treeb75aeae6b9d4925f7c36410a4f236ea09088e2bb /scene/gui/scroll_bar.cpp
parentdc67d0737b86c7a6cab66752b96631c59c703997 (diff)
Allow scroll_to_line when scroll_active is 'false'
Fix #36134
Diffstat (limited to 'scene/gui/scroll_bar.cpp')
-rw-r--r--scene/gui/scroll_bar.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index e7950bec98..4db6ca2949 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -506,6 +506,10 @@ void ScrollBar::_drag_node_exit() {
}
void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) {
+ if (!drag_node_enabled) {
+ return;
+ }
+
Ref<InputEventMouseButton> mb = p_input;
if (mb.is_valid()) {
@@ -590,6 +594,10 @@ NodePath ScrollBar::get_drag_node() const {
return drag_node_path;
}
+void ScrollBar::set_drag_node_enabled(bool p_enable) {
+ drag_node_enabled = p_enable;
+}
+
void ScrollBar::set_smooth_scroll_enabled(bool p_enable) {
smooth_scroll_enabled = p_enable;
}
@@ -610,19 +618,6 @@ void ScrollBar::_bind_methods() {
ScrollBar::ScrollBar(Orientation p_orientation) {
orientation = p_orientation;
- highlight = HIGHLIGHT_NONE;
- custom_step = -1;
- drag_node = nullptr;
-
- drag.active = false;
-
- drag_node_speed = Vector2();
- drag_node_touching = false;
- drag_node_touching_deaccel = false;
-
- scrolling = false;
- target_scroll = 0;
- smooth_scroll_enabled = false;
if (focus_by_default) {
set_focus_mode(FOCUS_ALL);