diff --git a/src/main.rs b/src/main.rs index 135d581..80196f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,6 +23,9 @@ const HOUR_NAMES: [&str; 24] = [ "Blossom", "Ladybug", "Geese", "Dust", "Peach", "Fog", "Acorn", "Gourd", "Soup", "Crow", "Mushroom", "Thunder", "Frost", "Lantern", ]; +// TODO: Make these configurable +const LATITUDE: f64 = 47.655235; +const LONGITUDE: f64 = 19.2868815; enum Season { Spring, @@ -175,7 +178,11 @@ fn get_range_path( let end_delta_x = radius * end_deg.to_radians().sin(); let end_delta_y = radius * (1.0 - end_deg.to_radians().cos()); - let large_arc_flag = if deg_diff.abs() >= 180.0 { 0 } else { 1 }; + let large_arc_flag = if start_deg < end_deg { + if deg_diff.abs() >= 180.0 { 0 } else { 1 } + } else { + if deg_diff.abs() >= 180.0 { 1 } else { 0 } + }; let path_data = PathData::new() .move_to((image_width / 2, image_width / 2)) @@ -248,10 +255,6 @@ fn gen_svg() -> Document { let local_time = local_timestamp.time().num_seconds_from_midnight() as i32; let utc_rotation = seconds_to_degrees(utc_offset); - // TODO: Make these configurable - let lat = 47.655235; - let long = 19.2868815; - // TODO: These should be calculated instead of hardcoded let image_width = 700u32; @@ -261,7 +264,7 @@ fn gen_svg() -> Document { let moon_radius = image_width as f32 * 0.071428571; let moon_phase = moon_illumination.phase * 28.0; - let sun_times = suncalc::get_times(unixtime, lat, long, None); + let sun_times = suncalc::get_times(unixtime, LATITUDE, LONGITUDE, None); let noon = Utc .timestamp_millis(sun_times.solar_noon.0) .time()