1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00
* Fix web
* Fix errors from ./scripts/check.sh
This commit is contained in:
Konkitoman
2023-10-19 18:50:48 +03:00
parent ec37d3861a
commit f5e1d0869e
4 changed files with 16 additions and 23 deletions

View File

@@ -9,7 +9,6 @@
#[cfg(not(target_arch = "wasm32"))]
mod icon_data;
use egui::ViewportBuilder;
#[cfg(not(target_arch = "wasm32"))]
pub use icon_data::IconData;
@@ -45,7 +44,7 @@ pub type EventLoopBuilderHook = Box<dyn FnOnce(&mut EventLoopBuilder<UserEvent>)
/// done by `eframe`.
#[cfg(not(target_arch = "wasm32"))]
#[cfg(any(feature = "glow", feature = "wgpu"))]
pub type WindowBuilderHook = Box<dyn FnOnce(ViewportBuilder) -> ViewportBuilder>;
pub type WindowBuilderHook = Box<dyn FnOnce(egui::ViewportBuilder) -> egui::ViewportBuilder>;
/// This is how your app is created.
///

View File

@@ -174,7 +174,7 @@ impl AppRunner {
/// Returns how long to wait until the next repaint.
///
/// Call [`Self::paint`] later to paint
pub fn logic(&mut self) -> (std::time::Duration, Vec<egui::ClippedPrimitive>) {
pub fn logic(&mut self) -> Vec<egui::ClippedPrimitive> {
let frame_start = now_sec();
super::resize_canvas_to_screen_size(self.canvas_id(), self.web_options.max_size_points);
@@ -188,7 +188,6 @@ impl AppRunner {
});
let egui::FullOutput {
platform_output,
repaint_after,
textures_delta,
shapes,
..
@@ -205,8 +204,7 @@ impl AppRunner {
self.frame.info.cpu_usage = Some((now_sec() - frame_start) as f32);
let repaint_after = repaint_after[&egui::ViewportId::MAIN];
(repaint_after, clipped_primitives)
clipped_primitives
}
/// Paint the results of the last call to [`Self::logic`].

View File

@@ -19,11 +19,8 @@ fn paint_and_schedule(runner_ref: &WebRunner) -> Result<(), JsValue> {
fn paint_if_needed(runner: &mut AppRunner) -> Result<(), JsValue> {
if runner.needs_repaint.when_to_repaint() <= now_sec() {
runner.needs_repaint.clear();
let (repaint_after, clipped_primitives) = runner.logic();
let clipped_primitives = runner.logic();
runner.paint(&clipped_primitives)?;
runner
.needs_repaint
.repaint_after(repaint_after.as_secs_f64());
runner.auto_save_if_needed();
}
Ok(())