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

Update html template css to better handle full screen canvas window #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

claudijo
Copy link

Update css in index.html according to the discussion bevyengine/bevy#4726 under the heading Easy "fullscreen window" mode for the default canvas.

Before this change setting window option fit_canvas_to_parent to true and building for the web will result in the canvas element growing vertically each time the window is resized regardless if the window is made wider or narrower. Also the canvas element height is not adjusted correctly if loaded in a browser window with a height is less than the canvas height.

With this change the canvas element grows and fits the browser window as expected, not least if published to itch.io and loaded in a mobile web browser.

@BorisBoutillier
Copy link

I can confirm that these change make the itch.io fullscreen mode work.

But as the bevy PR, it also requires to set fit_canvas_to_parent: true in the primary_window setting of the WindowPlugin.

So I suggest that we also update the src/main.rs in this template to include this configuration, something like :

        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                fit_canvas_to_parent: true,
                ..default()
            }),
            ..default()
        }))

This way, the template fully work for itch.io publication out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants