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

Use DOMMatrix to parse CSS transforms. #83

Merged
merged 3 commits into from Aug 23, 2020
Merged

Use DOMMatrix to parse CSS transforms. #83

merged 3 commits into from Aug 23, 2020

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Mar 3, 2020

No description provided.

@Fil
Copy link
Member

Fil commented Jun 4, 2020

tested under node (v10.16.3 and v14.4.0) I get this error

yarn test
/Users/fil/Sites/d3/d3-interpolate/src/transform/parse.js
6:64 error 'WebKitCSSMatrix' is not defined no-undef

In node WebKitCSSMatrix and DOMMatrix aren't defined; it's not a loss, since the current strategy using document.createElement doesn't work either (it just doesn't break any test, because this function is not tested).

We could import node-canvas@2, which has DOMMatrix, but parsing CSS transforms is not yet implemented (Automattic/node-canvas#1313).

So, in the meantime, we will need to eslint-disable no-undef that line.

@Fil
Copy link
Member

Fil commented Jun 4, 2020

For reference, fixes #57

@Fil Fil mentioned this pull request Jul 10, 2020
Merged
@Fil
Copy link
Member

Fil commented Aug 8, 2020

Here is a case where this crashes:

d3.interpolateTransformCss( "translateY(12px) scale(2)", "translateX(3em) rotate(5deg)");

now throws SyntaxError: Failed to construct 'DOMMatrix': Lengths must be absolute, not relative

(changing translateX(3em) to an absolute length works)

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

Successfully merging this pull request may close these issues.

None yet

2 participants