Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move first request_animation_frame into resize observer #4628

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

jprochazk
Copy link
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
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
35 checks passed
@emilk emilk deleted the fix-first-frame-resize branch June 6, 2024 08:30
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