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(usetrescontextprovider): fixed rendering issues caused when resize is triggered #512

Merged

Conversation

Steve245270533
Copy link
Contributor

Solved this issue (#511)

By minimizing the scene reproduction, I found that the real cause of jitter during rendering is the use of the two APIs useElementSize / useWindowSize.

They both use the ResizeObserver API, which is always a few milliseconds slower than the triggering of the onResize event.

I also compared the behavior of R3F when resizing and found that there is an anti shake operation.

Therefore, we only need to perform an anti-shake operation on the width and height values ​​to solve the problem.

Copy link

netlify bot commented Jan 16, 2024

Deploy Preview for tresjs-docs ready!

Name Link
🔨 Latest commit bb09534
🔍 Latest deploy log https://app.netlify.com/sites/tresjs-docs/deploys/65a69aea6e7bb200083e4637
😎 Deploy Preview https://deploy-preview-512--tresjs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@alvarosabu
Copy link
Member

Hello @Steve245270533 thank you very much for taking the time to open a ticket and create a PR with the fix, looks pretty solid, the debounce makes sense and it will also improve the performance

I will test it and give you feedback 🙏🏻

@alvarosabu alvarosabu self-requested a review January 16, 2024 16:49
@alvarosabu alvarosabu merged commit a16b12b into Tresjs:main Jan 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants