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

Set viewport meta in index.html #94

Merged
merged 2 commits into from
Dec 30, 2023
Merged

Set viewport meta in index.html #94

merged 2 commits into from
Dec 30, 2023

Conversation

kaydensigh
Copy link
Contributor

@kaydensigh kaydensigh commented Dec 28, 2023

Mobile browsers default to a width of ~980px to support desktop sites. Bevy then applies the device's scaling factor (usually around 2-3) to end up with a canvas of >2k width and >4k height (since most phones are ~2:1 tall).

Viewport meta seems to be the standard way to indicate that a web page can handle scaling for mobile.

The fields do the following:

  • width=device-width sets the page width to that of the device, with scaling factor applied (so on a 1080px wide physical device it would be ~450px).
  • initial-scale=1 ensures the width is updated when the device is rotated.
  • user-scalable=no prevents the default pinch-to-zoom behavior, which is not usually recommended, but makes sense for a game.

Mobile browsers default to a width of ~980px to support desktop sites. `width=device-width` sets the page width to that of the device instead.

`initial-scale=1` ensures the width is updated when the device is rotated.

`user-scalable=no` prevents the default pinch-to-zoom behavior.
@NiklasEi
Copy link
Owner

Thank you

@NiklasEi NiklasEi merged commit 505aff3 into NiklasEi:main Dec 30, 2023
5 checks passed
@kaydensigh kaydensigh deleted the meta_viewport branch December 31, 2023 08:53
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.

2 participants