Skip to content

Move first request_animation_frame into resize observer#4628

Merged
emilk merged 2 commits intomasterfrom
fix-first-frame-resize
Jun 6, 2024
Merged

Move first request_animation_frame into resize observer#4628
emilk merged 2 commits intomasterfrom
fix-first-frame-resize

Conversation

@jprochazk
Copy link
Copy Markdown
Collaborator

@jprochazk jprochazk commented Jun 6, 2024

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

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]

@jprochazk jprochazk added web Related to running Egui on the web eframe Relates to epi and eframe labels Jun 6, 2024
@jprochazk jprochazk changed the title Move request_animation_frame to resize observer Move first request_animation_frame into resize observer Jun 6, 2024
Copy link
Copy Markdown
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@emilk emilk merged commit 3d632cd into master Jun 6, 2024
@emilk emilk deleted the fix-first-frame-resize branch June 6, 2024 08:30
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
This PR ensures the first animation frame happens _after_ the resize
observer has had a chance to do its job.

* Closes emilk#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]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eframe Relates to epi and eframe web Related to running Egui on the web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web canvas size is tiny for the first frame

2 participants