1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Fix web demo

This commit is contained in:
Konkitoman
2023-08-06 10:31:48 +03:00
parent 085724b685
commit ee2f2a7986
2 changed files with 11 additions and 3 deletions

View File

@@ -178,14 +178,15 @@ impl AppRunner {
let canvas_size = super::canvas_size_in_points(self.canvas_id());
let raw_input = self.input.new_frame(canvas_size);
let full_output = self.egui_ctx.run(raw_input, |egui_ctx| {
self.app.update(egui_ctx, &mut self.frame);
let full_output = self.egui_ctx.run(raw_input, 0, 0, |egui_ctx| {
self.app.update(egui_ctx, &mut self.frame, None);
});
let egui::FullOutput {
platform_output,
repaint_after,
textures_delta,
shapes,
..
} = full_output;
self.handle_platform_output(platform_output);
@@ -199,6 +200,7 @@ impl AppRunner {
self.frame.info.cpu_usage = Some((now_sec() - frame_start) as f32);
let (_, repaint_after) = repaint_after[0];
(repaint_after, clipped_primitives)
}

View File

@@ -1,3 +1,4 @@
use egui::ViewportRender;
use egui_extras::RetainedImage;
use poll_promise::Promise;
@@ -54,7 +55,12 @@ impl Default for HttpApp {
}
impl eframe::App for HttpApp {
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
fn update(
&mut self,
ctx: &egui::Context,
frame: &mut eframe::Frame,
_: Option<&ViewportRender>,
) {
egui::TopBottomPanel::bottom("http_bottom").show(ctx, |ui| {
let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true);
ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| {