From 4957f3f30bf1fb05cf160f9d3bac17b0706326c2 Mon Sep 17 00:00:00 2001 From: Joe Ardent <code@ardent.nebcorp.com> Date: Sun, 23 Oct 2022 23:21:49 -0700 Subject: [PATCH] tweaks --- src/timer/eframe_app.rs | 10 ++-------- src/timer/mod.rs | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/timer/eframe_app.rs b/src/timer/eframe_app.rs index 16f064c..183942d 100644 --- a/src/timer/eframe_app.rs +++ b/src/timer/eframe_app.rs @@ -43,14 +43,8 @@ impl eframe::App for Timer { } fn get_color(t: f32) -> Color32 { - let sr = STARTING_COLOR[0]; - let sg = STARTING_COLOR[1]; - let sb = STARTING_COLOR[2]; - - let ur = UNIT_COLOR[0]; - let ug = UNIT_COLOR[1]; - let ub = UNIT_COLOR[2]; - + let [sr, sg, sb] = STARTING_COLOR; + let [ur, ug, ub] = UNIT_COLOR; let mag = t * 162.0; let (r, g, b) = ( (sr + (mag * ur).round()) as u8, diff --git a/src/timer/mod.rs b/src/timer/mod.rs index e6404fc..b74dd99 100644 --- a/src/timer/mod.rs +++ b/src/timer/mod.rs @@ -10,7 +10,6 @@ mod state; use state::{ChronoState, NextTimerState, TimerState}; mod eframe_app; mod gui; -use gui::*; #[derive(Debug, Clone, Copy)] pub enum CountDirection { @@ -97,7 +96,7 @@ impl Timer { self.done = 0.0; let (sender, rx) = channel(); - one_row(ui, &[(start, NextTimerState::Running)], sender); + gui::one_row(ui, &[(start, NextTimerState::Running)], sender); if rx.recv().is_ok() { let dur = self.duration; @@ -138,7 +137,7 @@ impl Timer { }; let color = Color32::DARK_GRAY; let tsize = size * DIGIT_FACTOR; - two_rows( + gui::two_rows( ui, &[(text, state::NextTimerState::Paused)], sender, @@ -187,7 +186,7 @@ impl Timer { CountDirection::Up => self.duration - remaining, }; - two_rows( + gui::two_rows( ui, &[ (resume, NextTimerState::Running), @@ -239,7 +238,7 @@ impl Timer { }; let (sender, rx) = channel(); - two_rows( + gui::two_rows( ui, &[(reset, NextTimerState::Running)], // technically we can send anything but let's try not to be misleading sender,