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
_getStrokeMatrix and placed symbols #1014
Comments
Could you please share the code that produces the error so we can reproduce it? Thanks. |
Pinging again, as a test-case is required for me to be able to say what the situation is here, and is actually much more important than a PR, because the issues should be understood fully first before attempting a fix. |
My apologies for not getting back to this. Unfortunately I'm no longer using the code-path that led me to originally encounter this problem, nor do I have time right now to try and create a small reproducable test case. If or when I do encounter this again, I'll revisit the issue, but for now I'll close it. Sorry for using up your time. Thanks for paper.js, it's all around fantastic! |
Let's keep this open for now, as it does sound like something that can happen in other situations. I'll look at the code and try to understand what might have produced it. |
Out of curiosity: You were working with symbols, correct? |
@lehni I get this error using paperJS in node when trying to access any This is using |
@lehni I'm also running into this and I'm able to reproduce it. It happens specifically when you try to get the bounds of a placed symbol with a stroke setting and stroke scaling set to false. I tried to get around this using @JaapSuter 's suggestion, but while the error went away, the bounds reported for the symbol were completely wrong. I can't reproduce that yet, but essentially what should have been a 4x4 square came back with a bounding rect that was 320x93. For now, I'm going to avoid using symbols as regular paths don't seem to have this problem. Let me know if I can help any more. |
Related: #856 |
Hello,
I apologize for not sending a pull request instead, but I don't have a decent git setup on my current computer. At any rate, I'm using placed symbols, and I'm getting an invalid null error with the following stack:
TypeError: Cannot read property 'getViewMatrix' of null at Path._getStrokeMatrix (_bundle.js:31297:28) at Function.getStrokeBounds (_bundle.js:36905:35) at Path._getBounds (_bundle.js:36865:23) at Path._getCachedBounds (_bundle.js:31283:22) at SymbolItem._getBounds (_bundle.js:33321:16) at SymbolItem._getCachedBounds (_bundle.js:31283:22) at SymbolItem.getBounds (_bundle.js:31233:22) at SymbolItem.getPosition (_bundle.js:31190:14) at SymbolItem.setPosition (_bundle.js:31196:55)
The definition of
_getStrokeMatrix
is as follows:_getStrokeMatrix: function(matrix, options) { return this.getStrokeScaling() ? matrix : (options && options.internal ? this : this._parent).getViewMatrix().invert()._shiftless(); },
I believe the reference to
this._parent
should be(this._parent || this._parentSymbol.getItem())
...I base that merely on a hunch, having seen this pattern in other parts of paper.js -- and also, my code no longer runs into that error, and works as expected.
But, I admit I haven't really dug into this too deep, so perhaps I'm wrong. I'm posting this in the hope that you'll say: "whoops, yeah -- oversight, thanks for catching that." But if instead you're not immediately convinced that's a proper fix, let me know and I'll do a proper deep dive, get a minimal repro, and find the actual problem (which may well be my fault entirely).
Kind regards,
Jaap Suter - http://jaapsuter.com
The text was updated successfully, but these errors were encountered: