Skip to content

Commit

Permalink
ScrollContainer expand children bug fix
Browse files Browse the repository at this point in the history
(cherry picked from commit 853161a)
  • Loading branch information
pkowal1982 authored and akien-mga committed Sep 18, 2016
1 parent ee23649 commit 2b43d0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/base/classes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34392,7 +34392,7 @@
A helper node for displaying scrollable elements (e.g. lists).
</brief_description>
<description>
A ScrollContainer node with a [Control] child and scrollbar child ([HScrollbar], [VScrollBar], or both) will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the minimum_size of the Control relative to the ScrollContainer. Works great with a [Panel] control.
A ScrollContainer node with a [Control] child and scrollbar child ([HScrollbar], [VScrollBar], or both) will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the minimum_size of the Control relative to the ScrollContainer. Works great with a [Panel] control. You can set EXPAND on children size flags, so they will upscale to ScrollContainer size if ScrollContainer size is bigger (scroll is invisible for chosen dimension).
</description>
<methods>
<method name="get_h_scroll" qualifiers="const">
Expand Down
4 changes: 2 additions & 2 deletions scene/gui/scroll_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ void ScrollContainer::_notification(int p_what) {
child_max_size.y = MAX(child_max_size.y, minsize.y);

Rect2 r = Rect2(-scroll,minsize);
if (!scroll_h) {
if (!h_scroll->is_visible()) {
r.pos.x=0;
if (c->get_h_size_flags()&SIZE_EXPAND)
r.size.width=MAX(size.width,minsize.width);
else
r.size.width=minsize.width;
}
if (!scroll_v) {
if (!v_scroll->is_visible()) {
r.pos.y=0;
r.size.height=size.height;
if (c->get_v_size_flags()&SIZE_EXPAND)
Expand Down

0 comments on commit 2b43d0a

Please sign in to comment.