summaryrefslogtreecommitdiffstats
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-09-18 20:04:39 +0200
committerGitHub <noreply@github.com>2017-09-18 20:04:39 +0200
commit30ba4076cd59a916054c28f4a7590b3884c88576 (patch)
tree95e750cc51879e9688c2532e89f7713108efe7e2 /scene/gui
parent7db006785c7cf48df253fadcfac68465745861c3 (diff)
parent7da0ec01c0ca5899cedcf383110c14e859be2af2 (diff)
downloadredot-engine-30ba4076cd59a916054c28f4a7590b3884c88576.tar.gz
Merge pull request #11372 from volzhs/fix-smooth-scroll
Fix smooth scrolling in ScrollBar
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/scroll_bar.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 16d1b320b7..41f4beb1c9 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -106,9 +106,9 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (ofs < grabber_ofs) {
if (scrolling) {
- target_scroll = target_scroll - get_page();
+ target_scroll = CLAMP(target_scroll - get_page(), get_min(), get_max() - get_page());
} else {
- target_scroll = get_value() - get_page();
+ target_scroll = CLAMP(get_value() - get_page(), get_min(), get_max() - get_page());
}
if (smooth_scroll_enabled) {
@@ -130,9 +130,9 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
update();
} else {
if (scrolling) {
- target_scroll = target_scroll + get_page();
+ target_scroll = CLAMP(target_scroll + get_page(), get_min(), get_max() - get_page());
} else {
- target_scroll = get_value() + get_page();
+ target_scroll = CLAMP(get_value() + get_page(), get_min(), get_max() - get_page());
}
if (smooth_scroll_enabled) {