1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

fix(core): workaround umlauts not being cleared

[no changelog]
This commit is contained in:
Martin Milata 2024-02-28 23:07:03 +01:00
parent 48124023d7
commit d790354667

View File

@ -32,6 +32,7 @@ pub struct Loader {
growing_duration: Duration, growing_duration: Duration,
shrinking_duration: Duration, shrinking_duration: Duration,
styles: LoaderStyleSheet, styles: LoaderStyleSheet,
offset_y: i16,
} }
impl Loader { impl Loader {
@ -54,6 +55,7 @@ impl Loader {
growing_duration: Duration::from_millis(GROWING_DURATION_MS), growing_duration: Duration::from_millis(GROWING_DURATION_MS),
shrinking_duration: Duration::from_millis(SHRINKING_DURATION_MS), shrinking_duration: Duration::from_millis(SHRINKING_DURATION_MS),
styles, styles,
offset_y: 0,
} }
} }
@ -140,7 +142,15 @@ impl Component for Loader {
type Msg = LoaderMsg; type Msg = LoaderMsg;
fn place(&mut self, bounds: Rect) -> Rect { fn place(&mut self, bounds: Rect) -> Rect {
self.pad.place(bounds); // Current loader API only takes Y-offset relative to screen center, which we
// compute from the bounds center point.
let screen_center = constant::screen().center();
self.offset_y = bounds.center().y - screen_center.y;
// FIXME: avoid umlauts rendering outside bounds
let mut bounds_up_to_top = bounds;
bounds_up_to_top.y0 = 0;
self.pad.place(bounds_up_to_top);
Rect::from_center_and_size(bounds.center(), Self::SIZE) Rect::from_center_and_size(bounds.center(), Self::SIZE)
} }
@ -182,15 +192,10 @@ impl Component for Loader {
self.styles.active self.styles.active
}; };
// Current loader API only takes Y-offset relative to screen center, which we
// compute from the bounds center point.
let screen_center = constant::screen().center();
let offset_y = self.pad.area.center().y - screen_center.y;
self.pad.paint(); self.pad.paint();
display::loader( display::loader(
progress, progress,
offset_y, self.offset_y,
style.loader_color, style.loader_color,
style.background_color, style.background_color,
style.icon, style.icon,