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

feat(TresCanvas): add dpr prop #768

Merged
merged 5 commits into from
Jul 12, 2024
Merged

feat(TresCanvas): add dpr prop #768

merged 5 commits into from
Jul 12, 2024

Conversation

andretchen0
Copy link
Contributor

@andretchen0 andretchen0 commented Jul 11, 2024

Problem

Tres sets the renderer's pixelRatio automatically, but doesn't allow the developer to specify or influence the value.

Solution

Add a :dpr prop to <TresCanvas /> that:

  • can be omitted, defaulting to current behavior.
  • can be number: overriding the system's pixelRatio.
  • can be [number, number], clamping the system's pixelRatio between the first (expected min) and second (expected max) values.

Playground

Playground demo added at:

http://localhost:5173/advanced/device-pixel-ratio

Meta

closes #765

@andretchen0 andretchen0 requested a review from alvarosabu July 11, 2024 14:11
Copy link

netlify bot commented Jul 11, 2024

Deploy Preview for tresjs-docs ready!

Name Link
🔨 Latest commit 7b25635
🔍 Latest deploy log https://app.netlify.com/sites/tresjs-docs/deploys/6690baaaadcd3d00082b57e9
😎 Deploy Preview https://deploy-preview-768--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.

@andretchen0 andretchen0 marked this pull request as ready for review July 11, 2024 14:12
@alvarosabu
Copy link
Member

You are awesome @andretchen0

@alvarosabu alvarosabu merged commit 8943cc3 into main Jul 12, 2024
7 checks passed
@alvarosabu alvarosabu deleted the feat/dpr branch July 12, 2024 05:15
@dghez
Copy link

dghez commented Jul 23, 2024

just FYI, is missing on the docs https://docs.tresjs.org/api/tres-canvas.html

@dghez
Copy link

dghez commented Jul 23, 2024

Left a new comment on the main thread #765 so i easier to track

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.

Library override the DPR setting in autonomy without chances to clamp / control it
3 participants