diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-13 16:10:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-13 16:10:12 +0100 |
commit | 04a1ae90df97ad317ea904a685300e988b37c613 (patch) | |
tree | 3825ede17b9ce46e666e16f60764eb00961c2db9 /scene/gui/scroll_container.cpp | |
parent | 1cf387ed9dcce39afb9c06b3a50b725d8b6f0461 (diff) | |
parent | bc8ce836e3585b100df0c4cddf6ef2bdada3460a (diff) |
Merge pull request #35080 from malbach/scrollbars_overlap
Fix #33309 Overlapping Scrollbars in ScrollContainer
Diffstat (limited to 'scene/gui/scroll_container.cpp')
-rw-r--r-- | scene/gui/scroll_container.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index dc1183df74..4712f4cb9d 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -420,6 +420,9 @@ void ScrollContainer::update_scrollbars() { v_scroll->hide(); scroll.y = 0; + + // modify the horizontal scrollbar's right anchor to fill the container's width + h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); } else { v_scroll->show(); @@ -431,12 +434,18 @@ void ScrollContainer::update_scrollbars() { } scroll.y = v_scroll->get_value(); + + // modify the horizontal scrollbar's right anchor to stop at the left of the vertical scrollbar + h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -vmin.width); } if (hide_scroll_h) { h_scroll->hide(); scroll.x = 0; + + // modify the vertical scrollbar's bottom anchor to fill the container's height + v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); } else { h_scroll->show(); @@ -448,6 +457,9 @@ void ScrollContainer::update_scrollbars() { } scroll.x = h_scroll->get_value(); + + // modify the vertical scrollbar's bottom anchor to stop at the top of the horizontal scrollbar + v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -hmin.height); } } |