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:
parent
f03e4c8d9c
commit
001acc770c
@ -129,7 +129,7 @@ impl ModelMercuryFeatures {
|
|||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_OUTER)
|
shape::Circle::new(center, constant::LOADER_OUTER)
|
||||||
.with_bg(fg_color)
|
.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);
|
.render(target);
|
||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
||||||
|
@ -234,7 +234,7 @@ impl Component for Loader {
|
|||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_OUTER)
|
shape::Circle::new(center, constant::LOADER_OUTER)
|
||||||
.with_bg(style.loader_color)
|
.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);
|
.render(target);
|
||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_INNER)
|
shape::Circle::new(center, constant::LOADER_INNER)
|
||||||
|
@ -121,7 +121,7 @@ impl ModelTTFeatures {
|
|||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_OUTER)
|
shape::Circle::new(center, constant::LOADER_OUTER)
|
||||||
.with_bg(fg_color)
|
.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);
|
.render(target);
|
||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
||||||
|
@ -135,8 +135,8 @@ where
|
|||||||
|
|
||||||
let start = (self.value as i16 - 100) % 1000;
|
let start = (self.value as i16 - 100) % 1000;
|
||||||
let end = (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 start = 360.0 * start as f32 / 1000.0;
|
||||||
let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
let end = 360.0 * end as f32 / 1000.0;
|
||||||
|
|
||||||
shape::Circle::new(center, LOADER_OUTER)
|
shape::Circle::new(center, LOADER_OUTER)
|
||||||
.with_bg(inactive_color)
|
.with_bg(inactive_color)
|
||||||
|
@ -250,7 +250,7 @@ impl Component for Loader {
|
|||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_OUTER)
|
shape::Circle::new(center, constant::LOADER_OUTER)
|
||||||
.with_bg(style.loader_color)
|
.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);
|
.render(target);
|
||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
||||||
|
@ -119,12 +119,12 @@ impl Component for Progress {
|
|||||||
let (start, end) = if self.indeterminate {
|
let (start, end) = if self.indeterminate {
|
||||||
let start = (self.value as i16 - 100) % 1000;
|
let start = (self.value as i16 - 100) % 1000;
|
||||||
let end = (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 start = 360.0 * start as f32 / 1000.0;
|
||||||
let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
let end = 360.0 * end as f32 / 1000.0;
|
||||||
(start, end)
|
(start, end)
|
||||||
} else {
|
} else {
|
||||||
let end = ((self.value as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
let end = 360.0 * self.value as f32 / 1000.0;
|
||||||
(0, end)
|
(0.0, end)
|
||||||
};
|
};
|
||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_OUTER)
|
shape::Circle::new(center, constant::LOADER_OUTER)
|
||||||
|
Loading…
Reference in New Issue
Block a user