Skip to content

[css-zoom] CSS Zoom and SVG #10490

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

Open
progers opened this issue Jun 24, 2024 · 0 comments
Open

[css-zoom] CSS Zoom and SVG #10490

progers opened this issue Jun 24, 2024 · 0 comments

Comments

@progers
Copy link
Contributor

progers commented Jun 24, 2024

Should CSS zoom be supported in SVG? Below are some examples:

<svg width="100" height="100" style="background: #006AA7;">
  <!-- zoom affecting css properties -->
  <rect style="x: 5px; y: 5px; width: 40px; height: 5px; fill: #fecc0284; zoom: 2;" />

  <!-- zoom affecting geometry properties -->
  <rect x="5" y="15" width="40" height="5" fill="#fecc0284" style="zoom: 2;" />

  <!-- nested zoom and geometry properties -->
  <g style="zoom: 2">
    <rect x="5" y="25" width="40" height="5" fill="#fecc0284" />
  </g>

  <!-- zoom affecting geometry attributes -->
  <line x1="5" y1="37.5" x2="45" y2="37.5" stroke-width="5" stroke="#fecc0284" style="zoom: 2;"/>
</svg>

For historical reasons, Blink and Webkit currently implement zoom as an additional transform at the SVG root, and ignore zoom inside SVG.

CSS spec questions:

SVG spec questions:

  • Should <length> attributes (e.g., x1) be affected by zoom?
    Yes, for consistency with styles (requires spec update)?
  • Should getBBox be affected by zoom?
    No, as the spec intends it to be a local value which is not affected by transform (requires spec update)?
  • Should getCTM be affected by zoom?
    Yes, as it should be used with getBBox to get a rect in the root coordinate space (requires spec update)?

cc: #5623 @chrishtr @emilio @szager-chromium

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

2 participants