use viewport units to prevent canvas from overflowing#4
Open
Klangspiel wants to merge 1 commit intoheadjump:masterfrom
Klangspiel:master
Open
use viewport units to prevent canvas from overflowing#4Klangspiel wants to merge 1 commit intoheadjump:masterfrom Klangspiel:master
Klangspiel wants to merge 1 commit intoheadjump:masterfrom
Klangspiel:master
Conversation
headjump
reviewed
Apr 8, 2019
| max-width: 512px; /* max game size: 512px */ | ||
| width: 512px; height: 512px; | ||
| width: 100vmin; /* ensures the game won't overflow the screen */ | ||
| image-rendering: optimizeSpeed; |
Owner
There was a problem hiding this comment.
Great Idea to use vmin there.
I'll test this soon, but at I first look I wonder if it shouldn't be more like
width: 512px;
height: 512px;
max-width: 100vmin;
max-height: 100vmin;
Author
There was a problem hiding this comment.
I went for the max-width in px and width in vmin in order to keep the change as small as possible. In practice, both are interchangeable without any change in behavior – the canvas will still cap out at either 512px or 100vmin. Your suggestion feels a lot clearer, though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this PR keeps the canvas from overflowing the screen in landscape mode.
I've kept the original widths to fall back to for browsers without viewport unit support.