From 0148cfc82b0076a050e13d72a7c1b144a8c67033 Mon Sep 17 00:00:00 2001 From: Nick Senger Date: Thu, 8 Jun 2023 07:51:32 -0700 Subject: fix: RedrawRequest::NextFrame -> RedrawRequest::At() --- examples/loading_spinners/src/circular.rs | 6 +++++- examples/loading_spinners/src/linear.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/loading_spinners/src/circular.rs b/examples/loading_spinners/src/circular.rs index 8639780a..56ffa6f5 100644 --- a/examples/loading_spinners/src/circular.rs +++ b/examples/loading_spinners/src/circular.rs @@ -266,6 +266,8 @@ where _clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, ) -> event::Status { + const FRAME_RATE: u64 = 60; + let state = tree.state.downcast_mut::(); if let Event::Window(window::Event::RedrawRequested(now)) = event { @@ -275,7 +277,9 @@ where now, ); - shell.request_redraw(RedrawRequest::NextFrame); + shell.request_redraw(RedrawRequest::At( + now + Duration::from_millis(1000 / FRAME_RATE), + )); } event::Status::Ignored diff --git a/examples/loading_spinners/src/linear.rs b/examples/loading_spinners/src/linear.rs index 6d151760..ea0807c2 100644 --- a/examples/loading_spinners/src/linear.rs +++ b/examples/loading_spinners/src/linear.rs @@ -194,12 +194,16 @@ where _clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, ) -> event::Status { + const FRAME_RATE: u64 = 60; + let state = tree.state.downcast_mut::(); if let Event::Window(window::Event::RedrawRequested(now)) = event { *state = state.timed_transition(self.cycle_duration, now); - shell.request_redraw(RedrawRequest::NextFrame); + shell.request_redraw(RedrawRequest::At( + now + Duration::from_millis(1000 / FRAME_RATE), + )); } event::Status::Ignored -- cgit