[Refactor] Move the seconds_to_degrees function to the svg_clock module
This commit is contained in:
parent
eb99194e16
commit
4c15ffa826
@ -18,8 +18,8 @@ use svg::Document;
|
|||||||
mod svg_clock;
|
mod svg_clock;
|
||||||
|
|
||||||
use svg_clock::{
|
use svg_clock::{
|
||||||
cache_hour_name_paths, hour_marker, svg_to_usvg, HOUR_NAMES, HOUR_NAME_FONT_SIZE, IMAGE_WIDTH,
|
cache_hour_name_paths, hour_marker, seconds_to_degrees, svg_to_usvg, HOUR_NAMES,
|
||||||
OUTER_R, RING_WIDTH, UTC_HOUR_FONT_SIZE,
|
HOUR_NAME_FONT_SIZE, IMAGE_WIDTH, OUTER_R, RING_WIDTH, UTC_HOUR_FONT_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
sctk::default_environment!(SeasonalClock, desktop);
|
sctk::default_environment!(SeasonalClock, desktop);
|
||||||
@ -36,10 +36,6 @@ struct CompleteConfig {
|
|||||||
seasonal_clock: Config,
|
seasonal_clock: Config,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn seconds_to_degrees(seconds: i32) -> f32 {
|
|
||||||
seconds as f32 * 360.0 / 86400.0
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_range_path(radius: f32, range_name: &str, start_time: i32, end_time: i32) -> Path {
|
fn get_range_path(radius: f32, range_name: &str, start_time: i32, end_time: i32) -> Path {
|
||||||
let start_deg = seconds_to_degrees(start_time);
|
let start_deg = seconds_to_degrees(start_time);
|
||||||
let end_deg = seconds_to_degrees(end_time);
|
let end_deg = seconds_to_degrees(end_time);
|
||||||
|
@ -43,6 +43,10 @@ impl fmt::Display for Season {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn seconds_to_degrees(seconds: i32) -> f32 {
|
||||||
|
seconds as f32 * 360.0 / 86400.0
|
||||||
|
}
|
||||||
|
|
||||||
pub fn svg_to_usvg(document: Document) -> Tree {
|
pub fn svg_to_usvg(document: Document) -> Tree {
|
||||||
let doc_str = document.to_string();
|
let doc_str = document.to_string();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user