浏览代码

-Fixed a bug in scrollcontainer not respecting expand flag
If you relied on this, make sure the children of your scrollcontainer
is set to expand with the expand flag in either vertical or horizontal axis

Juan Linietsky 10 年之前
父节点
当前提交
8f84f4117c
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      scene/gui/scroll_container.cpp

+ 9 - 1
scene/gui/scroll_container.cpp

@@ -195,11 +195,19 @@ void ScrollContainer::_notification(int p_what) {
 			Rect2 r = Rect2(-scroll,minsize);
 			Rect2 r = Rect2(-scroll,minsize);
 			if (!scroll_h) {
 			if (!scroll_h) {
 				r.pos.x=0;
 				r.pos.x=0;
-				r.size.width=size.width;
+				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 (!scroll_v) {
 				r.pos.y=0;
 				r.pos.y=0;
 				r.size.height=size.height;
 				r.size.height=size.height;
+				if (c->get_v_size_flags()&SIZE_EXPAND)
+					r.size.height=MAX(size.height,minsize.height);
+				else
+					r.size.height=minsize.height;
+
 			}
 			}
 			fit_child_in_rect(c,r);
 			fit_child_in_rect(c,r);
 		}
 		}