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 /src | |
parent | b3c0c076e5a1b1e7d76fa8d32af0bcbb2c1cd4cf (diff) | |
download | cru-26da84f59396075118ee769654471159e1f49980.tar.gz cru-26da84f59396075118ee769654471159e1f49980.tar.bz2 cru-26da84f59396075118ee769654471159e1f49980.zip |
...
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/UiHost.cpp | 3 | ||||
-rw-r--r-- | src/ui/render/TextRenderObject.cpp | 4 |
2 files changed, 4 insertions, 3 deletions
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()); } |