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

feat(core/rust): use f32 angles in ui components

[no changelog]
This commit is contained in:
cepetr 2024-05-16 16:12:44 +02:00 committed by cepetr
parent f03e4c8d9c
commit 001acc770c
6 changed files with 10 additions and 10 deletions

View File

@ -129,7 +129,7 @@ impl ModelMercuryFeatures {
shape::Circle::new(center, constant::LOADER_OUTER)
.with_bg(fg_color)
.with_end_angle(((progress as i32 * shape::PI4 as i32 * 8) / 1000) as i16)
.with_end_angle(360.0 * progress as f32 / 1000.0)
.render(target);
shape::Circle::new(center, constant::LOADER_INNER + 2)

View File

@ -234,7 +234,7 @@ impl Component for Loader {
shape::Circle::new(center, constant::LOADER_OUTER)
.with_bg(style.loader_color)
.with_end_angle(((progress as i32 * shape::PI4 as i32 * 8) / 1000) as i16)
.with_end_angle(360.0 * progress as f32 / 1000.0)
.render(target);
shape::Circle::new(center, constant::LOADER_INNER)

View File

@ -121,7 +121,7 @@ impl ModelTTFeatures {
shape::Circle::new(center, constant::LOADER_OUTER)
.with_bg(fg_color)
.with_end_angle(((progress as i32 * shape::PI4 as i32 * 8) / 1000) as i16)
.with_end_angle(360.0 * progress as f32 / 1000.0)
.render(target);
shape::Circle::new(center, constant::LOADER_INNER + 2)

View File

@ -135,8 +135,8 @@ where
let start = (self.value as i16 - 100) % 1000;
let end = (self.value as i16 + 100) % 1000;
let start = ((start as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
let start = 360.0 * start as f32 / 1000.0;
let end = 360.0 * end as f32 / 1000.0;
shape::Circle::new(center, LOADER_OUTER)
.with_bg(inactive_color)

View File

@ -250,7 +250,7 @@ impl Component for Loader {
shape::Circle::new(center, constant::LOADER_OUTER)
.with_bg(style.loader_color)
.with_end_angle(((progress as i32 * shape::PI4 as i32 * 8) / 1000) as i16)
.with_end_angle(360.0 * progress as f32 / 1000.0)
.render(target);
shape::Circle::new(center, constant::LOADER_INNER + 2)

View File

@ -119,12 +119,12 @@ impl Component for Progress {
let (start, end) = if self.indeterminate {
let start = (self.value as i16 - 100) % 1000;
let end = (self.value as i16 + 100) % 1000;
let start = ((start as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
let start = 360.0 * start as f32 / 1000.0;
let end = 360.0 * end as f32 / 1000.0;
(start, end)
} else {
let end = ((self.value as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
(0, end)
let end = 360.0 * self.value as f32 / 1000.0;
(0.0, end)
};
shape::Circle::new(center, constant::LOADER_OUTER)