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

Error while importing custom SVG #18

Closed
tuarrep opened this issue Jan 8, 2017 · 4 comments
Closed

Error while importing custom SVG #18

tuarrep opened this issue Jan 8, 2017 · 4 comments
Labels

Comments

@tuarrep
Copy link

tuarrep commented Jan 8, 2017

I encountered an error while importing a SVG file from my hard drive.
Here some technical details :

Imported svg data: Group @1
Uncaught Error: TypeError: Cannot read property '_visited' of null
    at o (vendor.js:7)
    at XMLHttpRequest.a (vendor.js:7)
    at XMLHttpRequest.e.onload (vendor.js:7)
  • Error in console (Firefox)
Type Error: a is null
  • On the site infinite loading
@Maddoc42
Copy link
Owner

Maddoc42 commented Jan 9, 2017

Hey @mafzst, sorry for your troubles and thanks for reporting this!

This seems to be a known issue with paper.js. It's fixed on their develop branch, which I have now deployed here. That seems to resolve the issue with some of the default icons. Fingers crossed 🤞

Let me know if that works for you! 🚀

@Maddoc42 Maddoc42 added the bug label Jan 9, 2017
@tuarrep
Copy link
Author

tuarrep commented Jan 9, 2017

Thanks for your reply,
Unfortunately it still not working.
Another error this time:

Uncaught Error: TypeError: Cannot read property 'push' of undefined
    at o (vendor.js:8)
    at XMLHttpRequest.a (vendor.js:8)
    at XMLHttpRequest.i.onload (vendor.js:7)

@Maddoc42
Copy link
Owner

Argh, there seem to be a couple of things going wrong here 🙈

I managed to fix a couple of them, now the icon loads and generates a valid shadow, however with a small offset. So far not sure what about the icon causes the shadow to shift.

For future references, here is a 'minimal' SVG file which displays this behavior:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg">
  <path d="M31.358,30.64c-0.935,0.252-1.489,1.212-1.239,2.148c0.251,0.933,1.213,1.489,2.147,1.239 c0.936-0.252,1.49-1.213,1.239-2.147C33.256,30.943,32.294,30.39,31.358,30.64z" />
  <circle cx="68.141" cy="32.335" r="1.754" />
</svg>

@Maddoc42
Copy link
Owner

Yeah, finally managed to resolve this 💪 seems like paper.js imports the SVG bounding box as an object, causing the original path to have different dimensions than the one visible later, which in turn shifts the shadow. Feel free to reopen if there is still a problem :)

icon

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