[Refactor] Move the seconds_to_degrees function to the svg_clock module

This commit is contained in:
Gergely Polonkai 2022-05-23 17:46:20 +02:00
parent eb99194e16
commit 4c15ffa826
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
2 changed files with 6 additions and 6 deletions

View File

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

View File

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