mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Fixing:
* Fix web * Fix errors from ./scripts/check.sh
This commit is contained in:
@@ -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.
|
||||
///
|
||||
|
||||
@@ -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`].
|
||||
|
||||
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user