From 4c15ffa82621b8313ba038672b394328a307f415 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 23 May 2022 17:46:20 +0200 Subject: [PATCH] [Refactor] Move the seconds_to_degrees function to the svg_clock module --- src/main.rs | 8 ++------ src/svg_clock.rs | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 96cd372..c70c57a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,8 +18,8 @@ use svg::Document; mod svg_clock; use svg_clock::{ - cache_hour_name_paths, hour_marker, svg_to_usvg, HOUR_NAMES, HOUR_NAME_FONT_SIZE, IMAGE_WIDTH, - OUTER_R, RING_WIDTH, UTC_HOUR_FONT_SIZE, + cache_hour_name_paths, hour_marker, seconds_to_degrees, svg_to_usvg, HOUR_NAMES, + HOUR_NAME_FONT_SIZE, IMAGE_WIDTH, OUTER_R, RING_WIDTH, UTC_HOUR_FONT_SIZE, }; sctk::default_environment!(SeasonalClock, desktop); @@ -36,10 +36,6 @@ struct CompleteConfig { 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 { let start_deg = seconds_to_degrees(start_time); let end_deg = seconds_to_degrees(end_time); diff --git a/src/svg_clock.rs b/src/svg_clock.rs index f60a68c..52913a3 100644 --- a/src/svg_clock.rs +++ b/src/svg_clock.rs @@ -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 { let doc_str = document.to_string();