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

Two.Utils.read.path throws an error #698

Open
2 tasks
AbdallahZ7 opened this issue Apr 18, 2023 · 3 comments
Open
2 tasks

Two.Utils.read.path throws an error #698

AbdallahZ7 opened this issue Apr 18, 2023 · 3 comments
Assignees
Labels

Comments

@AbdallahZ7
Copy link

Describe the bug
I'm trying to create a twojs path from an svg path string

To Reproduce
Steps to reproduce the behavior:
var d = 'M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,30 z';
var heart = Two.Utils.read.path(d);
two.add(heart);

trying the above code throws this error

caught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
at Object.applySvgAttributes (

Expected behavior
twojs path created from an svg path

Screenshots
image

Environment (please select one):

  • [ x] Code executes in browser (e.g: using script tag to load library)
  • Packaged software (e.g: ES6 imports, react, angular, vue.js)
  • Running headless (usually Node.js)
@AbdallahZ7 AbdallahZ7 added the bug label Apr 18, 2023
@jonobr1 jonobr1 self-assigned this Apr 18, 2023
@jonobr1
Copy link
Owner

jonobr1 commented Apr 18, 2023

Thanks for reporting. This PR fixes that issue: #699

@AbdallahZ7
Copy link
Author

that was quick, Thanks a lot @jonobr1

not sure how to test this change, I checked Versions of two.js on npm website, but don't see a new version

@jonobr1
Copy link
Owner

jonobr1 commented Apr 18, 2023

A new package isn't up, but you can npm install the git repo directly

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

No branches or pull requests

2 participants