Paperjs 0.9.25 - item.setRampPoint is not a function
Asked Answered
B

2

5

I have been using paperjs for a year now, without any issues. After a Chrome update (Version 55.0.2883.87 m) some production code that I hadn't touched for 2 months started failing with the error: item.setRampPoint is not a function:

paper-full.js:13213 Uncaught TypeError: item.setRampPoint is not a function

at offset (paper-full.js:13213)
at Object.<anonymous> (paper-full.js:13263)
at Object.forIn (paper-full.js:46)
at Function.each (paper-full.js:133)
at applyAttributes (paper-full.js:13260)
at importGroup (paper-full.js:12944)
at importSVG (paper-full.js:13324)
at Project.importSVG (paper-full.js:13356)
at drawAddLaneButtons (tlc.js:267)
at Path.window.drawTlcElements (tlc.js:62)

If I comment out the call to setRamPoint in the paperjs code it starts working again.

This happens when I try to load a SVG to the page, but, as I said before, it was working fine for a long time.

I am using version 0.9.25 of paperjs.

Any ideas?

Battlefield answered 22/12, 2016 at 18:3 Comment(9)
It will help to clarify in what situation you are calling item.setRampPoint. Is setRampPoint a function you wrote? And, if you want to check something quickly, try setRampPoint(item).Bribe
Hi, @EvSunWoodard. I am not calling 'setRamPoint' this is a internal function of paperjs. The funny thing is that this code is used every single day for thousands of users and it just stopped working after this last Chrome update. Everything still fine on IE and Firefox.Battlefield
What happens if you try the latest version of paper.js?Hardison
Hi @ChrisG. If I test it with the lastest version of paper.js I don't get the error anymore, but the SVGs I was loading on the canvas don't show anymore. I get a better result just commenting out the calling to setRamPoint in the line 13213 of the version 0.9.25.Battlefield
For future reference it has been fixed by changing the headers of the SVG I was import and using the latest version of paperjs.Battlefield
Could you please provide the SVG file that was causing this issue? I need to be able to reproduce it in order to say what's causing it. The issue for this problem is here: github.com/paperjs/paper.js/issues/1222Howes
@NelsonLarios I'd be interested in seeing this SVG file that also causes issues on the latest version, and understand why the headers needed changing. Ideally this wouldn't be required.Howes
@JürgLehni I will be on holidays for the next 10 days. I will make sure to post the code and the SVG file when I am back. Thanks.Battlefield
Hi @JürgLehni, it turns out that changing the headers was not necessary. Only updating to the newest version fixed the problem. Thanks, everybody!Battlefield
F
5

We had the same problem and updated to newly PaperJS version. It worked

Franciskus answered 30/12, 2016 at 19:31 Comment(2)
Came here with the same problem and updating to PaperJS 0.10.2 (newest at the moment) fixed it as wellEastman
How is the clone function not working? Could you report an issue over at github.com/paperjs/paper.js/issues ? Thanks!Howes
S
3

If someone wants to avoid updating paperjs.
A simple hack could be :

if (!paper.Item.prototype.setRampPoint) {
     paper.Item.prototype.setRampPoint = function () {};
}

Doesn't seem to break anything.

Scavenge answered 20/3, 2017 at 12:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.