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

[BUG] transformOrigin is not dynamically calculated for SVG elements hidden on initial render #2847

Open
njesenberger opened this issue Oct 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@njesenberger
Copy link

transformOrigin is not dynamically calculated and defaults to 0px 0px for SVG elements that are not displayed on initial render because they or their parent are set to display: none.

Minimal reproduction on CodeSandbox

Steps to reproduce:

  1. Click on the “Toggle” button to change the SVG element display from none to initial
  2. The square rotates from the top left corner instead of rotating from the center

Expected behavior:

transformOrigin should be dynamically calculated based on originX and originY values.

Note:

A workaround for elements that do not need a dynamic transformOrigin is to manually set originX and originY as strings (either px or %).

Documentation mentions the same workaround for animating scale and rotate on SVG elements with server-side rendering.

Related issue: #621

@njesenberger njesenberger added the bug Something isn't working label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant