refac(comp/timer): use full duration to show time
This commit is contained in:
parent
82d75caee1
commit
9ad9299c22
|
@ -108,7 +108,7 @@ where
|
|||
child.event(ctx, event, data, env);
|
||||
}
|
||||
Event::Timer(id) if *id == self.render_timer_id => {
|
||||
data.update_progress_and_time(self.start_time.elapsed(), duration, full_duration);
|
||||
data.update_progress_and_time(self.start_time.elapsed(), full_duration);
|
||||
ctx.request_paint();
|
||||
|
||||
self.render_timer_id = ctx.request_timer(TIMER_INTERVAL);
|
||||
|
|
11
src/state.rs
11
src/state.rs
|
@ -38,17 +38,12 @@ impl Timer {
|
|||
}
|
||||
|
||||
pub fn reset(&mut self, duration: Duration) {
|
||||
self.update_progress_and_time(Duration::ZERO, duration, duration)
|
||||
self.update_progress_and_time(Duration::ZERO, duration)
|
||||
}
|
||||
|
||||
pub fn update_progress_and_time(
|
||||
&mut self,
|
||||
elapsed: Duration,
|
||||
duration: Duration,
|
||||
full_duration: Duration,
|
||||
) {
|
||||
pub fn update_progress_and_time(&mut self, elapsed: Duration, full_duration: Duration) {
|
||||
self.update_progress(elapsed, full_duration);
|
||||
self.update_time(elapsed, duration);
|
||||
self.update_time(elapsed, full_duration);
|
||||
}
|
||||
|
||||
fn update_progress(&mut self, elapsed: Duration, duration: Duration) {
|
||||
|
|
Loading…
Reference in New Issue