aboutsummaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/control.cpp12
-rw-r--r--src/ui/controls/text_control.cpp5
2 files changed, 10 insertions, 7 deletions
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 37e6d2b8..d080ebb0 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -201,11 +201,11 @@ namespace cru {
const auto rect = GetRect(RectRange::Content);
graph::WithTransform(device_context, D2D1::Matrix3x2F::Translation(rect.left, rect.top),
[this](ID2D1DeviceContext* device_context)
- {
- OnDrawContent(device_context);
- DrawEventArgs args(this, this, device_context);
- draw_event.Raise(args);
- });
+ {
+ OnDrawContent(device_context);
+ DrawEventArgs args(this, this, device_context);
+ draw_event.Raise(args);
+ });
for (auto child : GetChildren())
child->Draw(device_context);
@@ -412,6 +412,7 @@ namespace cru {
namespace
{
+#ifdef CRU_DEBUG_LAYOUT
Microsoft::WRL::ComPtr<ID2D1Geometry> CalculateSquareRingGeometry(const Rect& out, const Rect& in)
{
const auto d2d1_factory = graph::GraphManager::GetInstance()->GetD2D1Factory();
@@ -427,6 +428,7 @@ namespace cru {
ThrowIfFailed(sink->Close());
return result_geometry;
}
+#endif
}
void Control::OnSizeChangedCore(SizeChangedEventArgs & args)
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();
}