playcanvas / playcanvas/engine
ScreenComponent in no blend, does not respect DPI
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
ScreenComponent when used in "none" screenBlend, does not respect screen's DPI.
Would be great to have a checkbox, that would ensure that window.devicePixelRatio is respected in calculation of sizes, when screenBlend is set to "none".
entity.screen.respectDpi = true;
Use case: if you have a text-heavy UI, like floating labels, buttons with text, etc. Then you would want to have text to be in readable size, by using screenBlend as "none", we guarantee that at any resolution and/or aspect ratio of canvas, we get consistent perceivable text size. But if screen uses some unconventional DPI, e.g.: Retina screens, or laptop screen with high resolution and 100%+ zoom mode on window. In such cases font does not take DPI in account, and becomes too small.
As people might be using current "non-DPI" mode, we can't make it default, as it will affect their UI's, so introducing such checkbox, which by default to be false - is a non-breaking change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ScreenComponent handling for screenBlend="none" and trace how it calculates sizes from the screen. Define the optional respectDpi behavior so false preserves current sizing and true uses window.devicePixelRatio; done means the API is available without changing existing users' UI behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100