Subpixel values are rounded causing misalignment
See original GitHub issueEnvironments
- Framework name: react-moveable
- Framework version: 0.16.2
Description
The offsetLeft/offsetTop unfortunately round the actual offsets. Hence, a style="left: 17.85px"
becomes offsetLeft == 18
. This occasionally causes visible misalignment. This is a bit even more difficult given that sometimes getBoundingClientRect()
is used for some operations, which is fractional, like here.
This could be addressed by using getBoundingClientRect()
everywhere. However, getBCR
is not always equivalent to offsetLeft/Top
. The difference between these two is not very common though.
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (12 by maintainers)
Top Results From Across the Web
CSS Sub-pixel Background Misalignments - Acko.net
This causes the background's position to be rounded the same way as the column on top. (*) Note that there is a choice...
Read more >How do I compute subpixel alignment when I do a ...
In a project I need to obtain a down-sampling image , and when downscaling factor is not interger , there is always some...
Read more >Misalignment of image and gradient border - Stack Overflow
For unknown reasons, some systems reproducibly show misalignment between the image and the border so that they are not concentric. On affected ...
Read more >Subpixel Registration and Distortion Measurement
These artifacts are likely caused by vignetting which has more effect on white parts of the pattern and so biases the registered location...
Read more >Sub-pixel rendering and borders - Chen Hui Jing
Safari's computed values seem to have some rounding somewhere Difference ... when dealing with sub-pixel rounding, but I can't be sure.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daybrush sorry, should have done it before, here it is https://codesandbox.io/s/moveable-alignement-b5ynwi (I added transform so it’s a bit more visible
This appears the issue with Chrome rounding the height/width. I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1049374