From a09c404359ae1eadd45debbf7c781f0af2aed27d Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 3 Apr 2023 16:06:27 +0200 Subject: [PATCH] fix(core): restore original Label bounds checking so that if the text does not vertically fit into the provided bounds, it will only render part of itself (and an optional ellipse) and remain properly vertically centered --- core/embed/rust/src/ui/component/label.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/embed/rust/src/ui/component/label.rs b/core/embed/rust/src/ui/component/label.rs index 034c30b97e..a1ab4baea7 100644 --- a/core/embed/rust/src/ui/component/label.rs +++ b/core/embed/rust/src/ui/component/label.rs @@ -78,7 +78,11 @@ where type Msg = Never; fn place(&mut self, bounds: Rect) -> Rect { - let height = self.text_height(bounds.width()); + let height = self + .layout + .with_bounds(bounds) + .fit_text(self.text.as_ref()) + .height(); let diff = bounds.height() - height; let insets = match self.vertical { Alignment::Start => Insets::bottom(diff),