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

Unexpected wrap caused by lost floating point precision #104

Open
nextend opened this issue Jul 26, 2024 · 10 comments
Open

Unexpected wrap caused by lost floating point precision #104

nextend opened this issue Jul 26, 2024 · 10 comments
Labels

Comments

@nextend
Copy link

nextend commented Jul 26, 2024

Steps To Reproduce

https://codesandbox.io/p/sandbox/modern-screenshot-forked-zdw9p9?file=%2Findex.html%3A11%2C9

  1. Open the given sandbox
  2. A B C D should be in single line

Problem: The last character gets wrapped into new line on the screenshot.

The problem caused by that the window.getComputedStyle() floating precision limited to 4 decimals.

The div element with font family declaration is 74.140625px (getBoundingClientRect()) in the original rendering. In the SVG created by the library it gets 74.1406px and that small missing area cause the wrap.

Both window.getComputedStyle(temp1).width and window.getComputedStyle(temp1).inlineSize reports '74.1406px'

@Gamewise
Copy link

Gamewise commented Aug 7, 2024

I've seen this issue as well.

@Gamewise
Copy link

Gamewise commented Oct 6, 2024

@nextend do you know if there is a way to fix this?

@t-rexwave
Copy link

Getting this issue as well. Any ideas for a fix or workaround?

@nextend
Copy link
Author

nextend commented Oct 26, 2024

I do not think that there will be workaround. We switched over server side rendering with headless Chrome.

@nextend
Copy link
Author

nextend commented Nov 6, 2024

@qq15725
Copy link
Owner

qq15725 commented Nov 6, 2024

@qq15725 This problem still happens with complex example with the new version too.

https://codesandbox.io/p/sandbox/modern-screenshot-forked-4fdxk6?file=%2Findex.html%3A17%2C23&workspaceId=192a8b3e-2754-418a-b6f2-6bb0195a7dc0

The url no access permissions

@nextend
Copy link
Author

nextend commented Nov 6, 2024

I made it public.

@qq15725
Copy link
Owner

qq15725 commented Nov 6, 2024

v4.5.1 looks normal

image

@nextend
Copy link
Author

nextend commented Nov 6, 2024

This is how it looks for me:
image

@qq15725 qq15725 reopened this Nov 6, 2024
@qq15725 qq15725 added the Bug label Nov 6, 2024
@dextrous-is-fun
Copy link

So excited for a fix for this if there is one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants