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

[no changelog]
cepetr/drawlib-anim
cepetr 3 weeks ago
parent f757d0e19b
commit 2d19351997

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

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

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

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

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

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

Loading…
Cancel
Save