diff options
author | crupest <crupest@outlook.com> | 2020-06-28 21:47:53 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-28 21:47:53 +0800 |
commit | 26da84f59396075118ee769654471159e1f49980 (patch) | |
tree | 1f30fa3a167ea8de92bd22b907c82971515b0ab1 | |
parent | b3c0c076e5a1b1e7d76fa8d32af0bcbb2c1cd4cf (diff) | |
download | cru-26da84f59396075118ee769654471159e1f49980.tar.gz cru-26da84f59396075118ee769654471159e1f49980.tar.bz2 cru-26da84f59396075118ee769654471159e1f49980.zip |
...
-rw-r--r-- | include/cru/ui/render/MeasureRequirement.hpp | 2 | ||||
-rw-r--r-- | src/ui/UiHost.cpp | 3 | ||||
-rw-r--r-- | src/ui/render/TextRenderObject.cpp | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/include/cru/ui/render/MeasureRequirement.hpp b/include/cru/ui/render/MeasureRequirement.hpp index 5af5a057..2be159f8 100644 --- a/include/cru/ui/render/MeasureRequirement.hpp +++ b/include/cru/ui/render/MeasureRequirement.hpp @@ -91,7 +91,7 @@ class MeasureLength final { else return right; } else { - if (left.IsNotSpecified()) + if (right.IsNotSpecified()) return left; else return std::min(left.length_, right.length_); diff --git a/src/ui/UiHost.cpp b/src/ui/UiHost.cpp index 09f8fd9b..56ce1eb9 100644 --- a/src/ui/UiHost.cpp +++ b/src/ui/UiHost.cpp @@ -365,6 +365,7 @@ void UiHost::UpdateCursor() { } Control* UiHost::HitTest(const Point& point) { - return root_render_object_->HitTest(point)->GetAttachedControl(); + const auto render_object = root_render_object_->HitTest(point); + return render_object ? render_object->GetAttachedControl() : nullptr; } } // namespace cru::ui diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp index 9cae65d6..e0c68683 100644 --- a/src/ui/render/TextRenderObject.cpp +++ b/src/ui/render/TextRenderObject.cpp @@ -189,11 +189,11 @@ Size TextRenderObject::OnMeasureContent(const MeasureRequirement& requirement, log::Warn( "TextRenderObject: Text actual height exceeds the required max " "height."); - result.width = requirement.max.width.GetLengthOrUndefined(); + result.height = requirement.max.height.GetLengthOrUndefined(); } else { result.height = std::max(result.height, preferred_size.height.GetLengthOr0()); - result.width = + result.height = std::max(result.height, requirement.min.height.GetLengthOr0()); } |