diff options
author | crupest <crupest@outlook.com> | 2020-03-03 00:02:12 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-03-03 00:02:12 +0800 |
commit | ebb8f7beba71fc0d3cd81f60559e4005e05e48d5 (patch) | |
tree | 82c565e00279b3c4a9df213ec2a41ab3ccb4529a /src/ui/render/text_render_object.cpp | |
parent | e429ec11ebfcc5ce858d375d31a08285c8b30695 (diff) | |
download | cru-ebb8f7beba71fc0d3cd81f60559e4005e05e48d5.tar.gz cru-ebb8f7beba71fc0d3cd81f60559e4005e05e48d5.tar.bz2 cru-ebb8f7beba71fc0d3cd81f60559e4005e05e48d5.zip |
Add canvas render object.
Diffstat (limited to 'src/ui/render/text_render_object.cpp')
-rw-r--r-- | src/ui/render/text_render_object.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/ui/render/text_render_object.cpp b/src/ui/render/text_render_object.cpp index 5022cc04..6048f731 100644 --- a/src/ui/render/text_render_object.cpp +++ b/src/ui/render/text_render_object.cpp @@ -64,14 +64,8 @@ void TextRenderObject::Draw(platform::graph::IPainter* painter) { } RenderObject* TextRenderObject::HitTest(const Point& point) { - const auto margin = GetMargin(); - const auto size = GetSize(); - return Rect{margin.left, margin.top, - std::max(size.width - margin.GetHorizontalTotal(), 0.0f), - std::max(size.height - margin.GetVerticalTotal(), 0.0f)} - .IsPointInside(point) - ? this - : nullptr; + const auto padding_rect = GetPaddingRect(); + return padding_rect.IsPointInside(point) ? this : nullptr; } Size TextRenderObject::OnMeasureContent(const Size& available_size) { |