Closed cs-NET closed 5 years ago
Could you provide code, e.g. on http://sketch.paperjs.org, to reproduce the error? And which version of the library are you encountering this with? Most importantly, could you provide such a file?
@lehni sorry it took so long to get to this. It took me a while but here is some code that will cause the exception on FireFox and Safari. Chrome will ignore it.
var path = new Path.Circle(100,100, 10);
path.fillColor = '#0000FF';
path.removeSegments();
path.add(new Point(100, 100));
path.add(new Point(101, 100));
path.smooth();
path.rasterize();
The obvious question is why are you trying to draw something with a width of zero? Well, it happens!
As a workaround, we extended the if (element) to also check for a valid width and height.
The main issue is that once thrown it prevents all future updates to the canvas across all paper.js projects. Here is the exception to help others looking for a solution:
InvalidStateError: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.