mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 23:13:13 -04:00
Fix the web backend too
This commit is contained in:
@@ -259,8 +259,8 @@ impl AppRunner {
|
||||
let needs_repaint: std::sync::Arc<NeedRepaint> = Default::default();
|
||||
{
|
||||
let needs_repaint = needs_repaint.clone();
|
||||
egui_ctx.set_request_repaint_callback(move || {
|
||||
needs_repaint.repaint_asap();
|
||||
egui_ctx.set_request_repaint_callback(move |info| {
|
||||
needs_repaint.repaint_after(info.after.as_secs_f64());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,15 @@ use egui::Key;
|
||||
|
||||
use super::*;
|
||||
|
||||
struct IsDestroyed(pub bool);
|
||||
|
||||
/// Calls `request_animation_frame` to schedule repaint.
|
||||
///
|
||||
/// It will only paint if needed, but will always call `request_animation_frame` immediately.
|
||||
pub fn paint_and_schedule(
|
||||
runner_ref: &AppRunnerRef,
|
||||
panicked: Arc<AtomicBool>,
|
||||
) -> Result<(), JsValue> {
|
||||
struct IsDestroyed(pub bool);
|
||||
|
||||
fn paint_if_needed(runner_ref: &AppRunnerRef) -> Result<IsDestroyed, JsValue> {
|
||||
let mut runner_lock = runner_ref.lock();
|
||||
let is_destroyed = runner_lock.is_destroyed.fetch();
|
||||
|
||||
Reference in New Issue
Block a user