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

Wrong calculation for getRoundRect stroke width #534

Open
victor-wm opened this issue May 14, 2024 · 2 comments
Open

Wrong calculation for getRoundRect stroke width #534

victor-wm opened this issue May 14, 2024 · 2 comments

Comments

@victor-wm
Copy link

https://github.com/rdkcentral/Lightning/blob/master/src/tools/Tools.mjs#L55 defines the canvas width as w + strokeWidth + 2 but I think that was a mistake. The real size should have been w + strokeWidth * 2 instead.

@elsassph
Copy link
Contributor

Actually I'm not sure it's wrong.

@elsassph
Copy link
Contributor

elsassph commented Jun 6, 2024

Calculations are correct, but...

Left: element without w/h set
Right: element with w/h set (as passed to getRoundRect)
image

The problem is that when requesting a texture of a certain width/height, you don't actually get the requested size, but the size + stroke + 1... which means in a lot of places where we use this util, we create textures which get squeezed a bit and thus lose their quality.

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

No branches or pull requests

2 participants