aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/controls/linear_layout.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-10 00:09:52 +0800
committercrupest <crupest@outlook.com>2018-09-10 00:09:52 +0800
commitaa8ba64f4f580552ba14325dd3e04f38a3c9a1de (patch)
treecde762da1a0bfb24c28a8a3dfa5253ad95a5b809 /CruUI/ui/controls/linear_layout.cpp
parent74031db4b8c366531db5be8fa8d765483ab377b0 (diff)
downloadcru-aa8ba64f4f580552ba14325dd3e04f38a3c9a1de.tar.gz
cru-aa8ba64f4f580552ba14325dd3e04f38a3c9a1de.tar.bz2
cru-aa8ba64f4f580552ba14325dd3e04f38a3c9a1de.zip
...
Diffstat (limited to 'CruUI/ui/controls/linear_layout.cpp')
-rw-r--r--CruUI/ui/controls/linear_layout.cpp8
1 files changed, 8 insertions, 0 deletions
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;