1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

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
This commit is contained in:
matejcik 2023-04-03 16:06:27 +02:00
parent bd491bb2da
commit a09c404359

View File

@ -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),