1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

eframe web: access app from WebHandle (#1886)

Co-authored-by: Stanislav <enomado@users.noreply.github.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Stanislav
2022-09-09 09:22:46 +03:00
committed by GitHub
parent e0c7533ede
commit ebc4fc866d
8 changed files with 80 additions and 1 deletions

View File

@@ -3,6 +3,9 @@ use egui_demo_lib::is_mobile;
#[cfg(feature = "glow")]
use eframe::glow;
#[cfg(target_arch = "wasm32")]
use core::any::Any;
#[derive(Default)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
struct EasyMarkApp {
@@ -13,6 +16,11 @@ impl eframe::App for EasyMarkApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
self.editor.panels(ctx);
}
#[cfg(target_arch = "wasm32")]
fn as_any_mut(&mut self) -> &mut dyn Any {
&mut *self
}
}
// ----------------------------------------------------------------------------
@@ -27,6 +35,11 @@ impl eframe::App for DemoApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
self.demo_windows.ui(ctx);
}
#[cfg(target_arch = "wasm32")]
fn as_any_mut(&mut self) -> &mut dyn Any {
&mut *self
}
}
// ----------------------------------------------------------------------------
@@ -46,6 +59,11 @@ impl eframe::App for FractalClockApp {
.ui(ui, Some(crate::seconds_since_midnight()));
});
}
#[cfg(target_arch = "wasm32")]
fn as_any_mut(&mut self) -> &mut dyn Any {
&mut *self
}
}
// ----------------------------------------------------------------------------
@@ -70,6 +88,11 @@ impl eframe::App for ColorTestApp {
});
});
}
#[cfg(target_arch = "wasm32")]
fn as_any_mut(&mut self) -> &mut dyn Any {
&mut *self
}
}
// ----------------------------------------------------------------------------
@@ -225,6 +248,11 @@ impl eframe::App for WrapApp {
custom3d.on_exit(gl);
}
}
#[cfg(target_arch = "wasm32")]
fn as_any_mut(&mut self) -> &mut dyn Any {
&mut *self
}
}
impl WrapApp {