aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-05 21:26:04 +0800
committercrupest <crupest@outlook.com>2018-11-05 21:26:04 +0800
commitcefb75a4c09e72a1f67e11765f2a8b6fd9581ed6 (patch)
treebccc82a17ca0ceb04831e7babd6e8902c3e882d8 /src/ui/controls/text_control.cpp
parent1dab244aaad8694ba37ef43caedd8c8ba0310c00 (diff)
downloadcru-cefb75a4c09e72a1f67e11765f2a8b6fd9581ed6.tar.gz
cru-cefb75a4c09e72a1f67e11765f2a8b6fd9581ed6.tar.bz2
cru-cefb75a4c09e72a1f67e11765f2a8b6fd9581ed6.zip
Fix a bug in text control.
Diffstat (limited to 'src/ui/controls/text_control.cpp')
-rw-r--r--src/ui/controls/text_control.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp
index 5769af58..09bc29e1 100644
--- a/src/ui/controls/text_control.cpp
+++ b/src/ui/controls/text_control.cpp
@@ -77,8 +77,9 @@ namespace cru::ui::controls
void TextControl::OnSizeChangedCore(events::SizeChangedEventArgs& args)
{
Control::OnSizeChangedCore(args);
- ThrowIfFailed(text_layout_->SetMaxWidth(args.GetNewSize().width));
- ThrowIfFailed(text_layout_->SetMaxHeight(args.GetNewSize().height));
+ const auto content = GetRect(RectRange::Content);
+ ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
+ ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
Repaint();
}