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

Improve the accuracy of device-pixel-content-box when moving elements across pixels #117

Open
TremayneChrist opened this issue Oct 7, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@TremayneChrist
Copy link
Member

When observing device-pixel-content-box incorrect values could be reported. This is due to pixel pixel rounding/snapping when devicePixelRatio is greater than 1. This issue is exaggerated when dragging elements across pixels.

From the spec:

The device-pixel-content-box can be approximated by multiplying devicePixelRatio by the content-box size. However, due to browser-specific subpixel snapping behavior, authors cannot determine the correct way to round this scaled content-box size. How a UA computes the device pixel box for an element is implementation-dependent. One possible implementation could be to multiply the box size and position by the device pixel ratio, then round both the resulting floating-point size and position of the box to integer values, in a way that maximizes the quality of the rendered output.

@TremayneChrist TremayneChrist added the enhancement New feature or request label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant