question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subpixel values are rounded causing misalignment

See original GitHub issue

Environments

  • 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:open
  • Created 4 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
bytasvcommented, Dec 7, 2022

@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

1reaction
dvoytenkocommented, Feb 5, 2020

This appears the issue with Chrome rounding the height/width. I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1049374

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found