diff options
author | crupest <crupest@outlook.com> | 2018-11-11 16:50:52 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-11-11 16:50:52 +0800 |
commit | 14394d9a86ebf947176b0c4d850692b760d5980f (patch) | |
tree | 0b3f9f274977c3f1561df58b80d3d0865a586a59 /src/ui/controls/linear_layout.cpp | |
parent | b0e39c622fb94bd399812fd3368fd4197029a878 (diff) | |
download | cru-14394d9a86ebf947176b0c4d850692b760d5980f.tar.gz cru-14394d9a86ebf947176b0c4d850692b760d5980f.tar.bz2 cru-14394d9a86ebf947176b0c4d850692b760d5980f.zip |
Fix the bug.
Diffstat (limited to 'src/ui/controls/linear_layout.cpp')
-rw-r--r-- | src/ui/controls/linear_layout.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ui/controls/linear_layout.cpp b/src/ui/controls/linear_layout.cpp index f21a9933..3789b305 100644 --- a/src/ui/controls/linear_layout.cpp +++ b/src/ui/controls/linear_layout.cpp @@ -89,9 +89,28 @@ namespace cru::ui::controls } if (orientation_ == Orientation::Horizontal) + { + for (auto control : GetChildren()) + { + if (control->GetLayoutParams()->height.mode == MeasureMode::Stretch) + { + control->SetDesiredSize(Size(control->GetDesiredSize().width, secondary_side_child_max_length)); + } + } actual_size_for_children.height = secondary_side_child_max_length; + } else + { + for (auto control : GetChildren()) + { + if (control->GetLayoutParams()->width.mode == MeasureMode::Stretch) + { + control->SetDesiredSize(Size(secondary_side_child_max_length, control->GetDesiredSize().height)); + } + } + actual_size_for_children.width = secondary_side_child_max_length; + } return actual_size_for_children; } |