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

Invalid percentage lengths when viewbox ratio is different from width/height #2330

Open
jakex7 opened this issue Jul 4, 2024 · 0 comments
Open

Comments

@jakex7
Copy link
Member

jakex7 commented Jul 4, 2024

Description

When the viewBox ratio differs from the width and height attributes (e.g., height="500" width="100" viewBox="0 0 200 200"), the lengths passed as percentage values are incorrect. This inconsistency leads to rendering issues where the expected size does not match the actual size.

Affected platforms

Platform is affected
iOS
Android
Web 𝙓

Example

These two rectangles are supposed to be the same size

<Svg height="500" width="100" viewBox="0 0 200 200">
  <Rect
    x="0"
    y="0"
    width="200"
    height="200"
    fill="none"
    stroke="blue"
    strokeWidth="10"
  />
  <Rect
    x="0"
    y="0"
    width="100%"
    height="100%"
    fill="none"
    stroke="green"
    strokeWidth="10"
  />
</Svg>

Expected (from web)

image

Actual

image

Steps to reproduce

Run the code snippet from above / snack

Snack or a link to a repository

https://snack.expo.dev/medooIzWuqe50tTnkheiT

SVG version

15.3.0 and from main branch

@jakex7 jakex7 added the bug label Jul 4, 2024
@github-actions github-actions bot added Repro provided Missing info The user didn't precise the problem enough labels Jul 4, 2024
@jakex7 jakex7 removed the Missing info The user didn't precise the problem enough label Jul 4, 2024
@software-mansion software-mansion deleted a comment from github-actions bot Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant