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

fix(core): fix lockscreen animation cutting from right and bottom

[no changelog]
This commit is contained in:
tychovrahe 2024-06-04 11:49:59 +02:00 committed by matejcik
parent 2f6ade5911
commit 0cd36cd41b
2 changed files with 8 additions and 7 deletions

View File

@ -354,8 +354,8 @@ impl Component for Lockscreen {
}
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
const OVERLAY_SIZE: i16 = 170;
const OVERLAY_BORDER: i16 = (AREA.height() - OVERLAY_SIZE) / 2;
const OVERLAY_RADIUS: i16 = 85;
const OVERLAY_BORDER: i16 = (AREA.height() / 2) - OVERLAY_RADIUS;
const OVERLAY_OFFSET: i16 = 9;
let center = AREA.center();
@ -369,7 +369,7 @@ impl Component for Lockscreen {
.with_bg(Color::black())
.render(target);
shape::Bar::new(AREA.split_bottom(OVERLAY_BORDER - OVERLAY_OFFSET).1)
shape::Bar::new(AREA.split_bottom(OVERLAY_BORDER - OVERLAY_OFFSET - 2).1)
.with_bg(Color::black())
.render(target);
@ -377,7 +377,7 @@ impl Component for Lockscreen {
.with_bg(Color::black())
.render(target);
shape::Bar::new(AREA.split_right(OVERLAY_BORDER).1)
shape::Bar::new(AREA.split_right(OVERLAY_BORDER - 2).1)
.with_bg(Color::black())
.render(target);

View File

@ -69,7 +69,7 @@ impl UnlockOverlay {
canvas.fill_sector(center, r, 180.0 + angle, 280.0 + angle, transp);
canvas.fill_circle(center, r - Self::THICKNESS, opaque, 255);
// Innner fixed circle
// Inner fixed circle
let r = Self::RADIUS - (9 * Self::SPAN) / 2;
canvas.fill_circle(center, r, transp, 255);
canvas.fill_circle(center, r - Self::THICKNESS, opaque, 255);
@ -78,9 +78,10 @@ impl UnlockOverlay {
impl<'a> Shape<'a> for UnlockOverlay {
fn bounds(&self) -> Rect {
// +1 pixel because middle pixel is not counted in circle radius
Rect::new(
self.pos - Offset::uniform(Self::RADIUS),
self.pos + Offset::uniform(Self::RADIUS + 1),
self.pos - Offset::uniform(Self::RADIUS + 1),
self.pos + Offset::uniform(Self::RADIUS + 2),
)
}