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

fix: add orientation handling #3365

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

DennisSmolek
Copy link
Contributor

This adds an orientation handler to useMeasure so that when the device rotates it correctly adjusts the canvas.

Right now, when a phone rotates the window resize event never fires so the canvas doesn't know it should change, and as the resize handler sets the css sizes directly on the canvas it causes it to bleed over the edge or if you go from horizontal to vertical causes it to leave a big black area in the viewport.

You can simulate this in chrome by using the developer tools device preview button. Load a mobile device, Load a canvas (typically a full size one) and then change the orientation with the orientation button.

added handlers to the useMeasure  hook
Copy link

codesandbox-ci bot commented Sep 24, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7a78500:

Sandbox Source
example Configuration

@CodyJasonBennett
Copy link
Member

@drcmda, we'll want to upstream improvements here to use-measure.

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