fix: RedrawRequest::NextFrame -> RedrawRequest::At()
This commit is contained in:
parent
56eacdb358
commit
0148cfc82b
2 changed files with 10 additions and 2 deletions
|
|
@ -266,6 +266,8 @@ where
|
||||||
_clipboard: &mut dyn Clipboard,
|
_clipboard: &mut dyn Clipboard,
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
) -> event::Status {
|
) -> event::Status {
|
||||||
|
const FRAME_RATE: u64 = 60;
|
||||||
|
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
||||||
if let Event::Window(window::Event::RedrawRequested(now)) = event {
|
if let Event::Window(window::Event::RedrawRequested(now)) = event {
|
||||||
|
|
@ -275,7 +277,9 @@ where
|
||||||
now,
|
now,
|
||||||
);
|
);
|
||||||
|
|
||||||
shell.request_redraw(RedrawRequest::NextFrame);
|
shell.request_redraw(RedrawRequest::At(
|
||||||
|
now + Duration::from_millis(1000 / FRAME_RATE),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
event::Status::Ignored
|
event::Status::Ignored
|
||||||
|
|
|
||||||
|
|
@ -194,12 +194,16 @@ where
|
||||||
_clipboard: &mut dyn Clipboard,
|
_clipboard: &mut dyn Clipboard,
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
) -> event::Status {
|
) -> event::Status {
|
||||||
|
const FRAME_RATE: u64 = 60;
|
||||||
|
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
||||||
if let Event::Window(window::Event::RedrawRequested(now)) = event {
|
if let Event::Window(window::Event::RedrawRequested(now)) = event {
|
||||||
*state = state.timed_transition(self.cycle_duration, now);
|
*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
|
event::Status::Ignored
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue