From aa8ba64f4f580552ba14325dd3e04f38a3c9a1de Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 10 Sep 2018 00:09:52 +0800 Subject: ... --- CruUI/ui/controls/linear_layout.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'CruUI/ui/controls/linear_layout.cpp') diff --git a/CruUI/ui/controls/linear_layout.cpp b/CruUI/ui/controls/linear_layout.cpp index f639720d..1d88a4e1 100644 --- a/CruUI/ui/controls/linear_layout.cpp +++ b/CruUI/ui/controls/linear_layout.cpp @@ -44,9 +44,17 @@ namespace cru::ui::controls { control->Measure(rest_available_size_for_children); if (orientation_ == Orientation::Horizontal) + { rest_available_size_for_children.width -= control->GetDesiredSize().width; + if (rest_available_size_for_children.width < 0) + rest_available_size_for_children.width = 0; + } else + { rest_available_size_for_children.height -= control->GetDesiredSize().height; + if (rest_available_size_for_children.height < 0) + rest_available_size_for_children.height = 0; + } }); auto actual_size_for_children = total_available_size_for_children - rest_available_size_for_children; -- cgit v1.2.3