Skip to content

Commit

Permalink
Fix web build
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 15, 2023
1 parent d231a05 commit 46bea93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/eframe/src/web/app_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl AppRunner {
{
let needs_repaint = needs_repaint.clone();
egui_ctx.set_request_repaint_callback(move |info| {
needs_repaint.repaint_after(info.after.as_secs_f64());
needs_repaint.repaint_after(info.delay.as_secs_f64());
});
}

Expand Down
14 changes: 7 additions & 7 deletions crates/egui_glow/examples/pure_glow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn main() {
.expect("Cannot send event");
});

let mut repaint_after = std::time::Duration::MAX;
let mut repaint_delay = std::time::Duration::MAX;

event_loop.run(move |event, _, control_flow| {
let mut redraw = || {
Expand All @@ -184,13 +184,13 @@ fn main() {

*control_flow = if quit {
winit::event_loop::ControlFlow::Exit
} else if repaint_after.is_zero() {
} else if repaint_delay.is_zero() {
gl_window.window().request_redraw();
winit::event_loop::ControlFlow::Poll
} else if let Some(repaint_after_instant) =
std::time::Instant::now().checked_add(repaint_after)
} else if let Some(repaint_delay_instant) =
std::time::Instant::now().checked_add(repaint_delay)
{
winit::event_loop::ControlFlow::WaitUntil(repaint_after_instant)
winit::event_loop::ControlFlow::WaitUntil(repaint_delay_instant)
} else {
winit::event_loop::ControlFlow::Wait
};
Expand Down Expand Up @@ -242,8 +242,8 @@ fn main() {
}
}

winit::event::Event::UserEvent(UserEvent::Redraw(after)) => {
repaint_after = after;
winit::event::Event::UserEvent(UserEvent::Redraw(delay)) => {
repaint_delay = delay;
}
winit::event::Event::LoopDestroyed => {
egui_glow.destroy();
Expand Down

0 comments on commit 46bea93

Please sign in to comment.