Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Uncaught Error: 'matrix(1, 0, 0, 1, 0, -6.6763e-06)' is not a matrix #12

Closed
pinyin opened this issue Feb 13, 2018 · 5 comments
Closed
Labels

Comments

@pinyin
Copy link

pinyin commented Feb 13, 2018

Chrome sometimes return transform matrix in an exponential notation, e.g. -6.6763e-06 in this case.
Is this not supported?

@chrvadala
Copy link
Owner

I'm not sure that you're talking about the parse ability but in that case unfortunately is not supported

@pinyin
Copy link
Author

pinyin commented Feb 14, 2018

Yes, I was talking about the fromString utility, sorry for the ambiguity.
Thanks for your work.

@chrvadala
Copy link
Owner

The problem is in this line

const matrixRegex = /^matrix\(\s*(-?[0-9]*\.?[0-9]+)\s*,\s*(-?[0-9]*\.?[0-9]+)\s*,\s*(-?[0-9]*\.?[0-9]+)\s*,\s*(-?[0-9]*\.?[0-9]+)\s*,\s*(-?[0-9]*\.?[0-9]+)\s*,\s*(-?[0-9]*\.?[0-9]+)\s*\)$/i;

That regex doesn't support number in that format

You can provide a different Regex to support number formatted in that way.
I think that you can change (-?[0-9]*\.?[0-9]+) with ([0-9e-]+), but I'm not sure that it's enough safe

@chrvadala chrvadala added bug and removed question labels Feb 14, 2018
@pinyin
Copy link
Author

pinyin commented Feb 15, 2018

OK, I'll try that. Thanks!

@chrvadala
Copy link
Owner

Fixed with 1.8.0

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

No branches or pull requests

2 participants