Move first request_animation_frame into resize observer (#4628)

This PR ensures the first animation frame happens _after_ the resize
observer has had a chance to do its job.

* Closes https://github.com/emilk/egui/issues/4622

The first commit contains some `log` calls to observe the changed
behavior:

Before:
```
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [300.0 150.0]
[eframe::web::events] eframe/src/web/events.rs:633: ResizeObserver canvas=[300.0 150.0] to=(1920, 993)
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
```

After:
```
[eframe::web::events] eframe/src/web/events.rs:633: ResizeObserver canvas=[300.0 150.0] to=(1920, 993)
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
```
This commit is contained in:
Jan Procházka
2024-06-06 10:30:32 +02:00
committed by GitHub
parent cbb5d6aa93
commit 3d632cd333
2 changed files with 14 additions and 2 deletions
+1 -2
View File
@@ -79,9 +79,8 @@ impl WebRunner {
events::install_color_scheme_change_event(self)?;
}
// The resize observer handles calling `request_animation_frame` to start the render loop.
events::install_resize_observer(self)?;
self.request_animation_frame()?;
}
Ok(())