Reputation: 3120
Example: https://jsfiddle.net/gnxdkqgh/5/
x0.5
- everything works as expectedx2
- part of the canvas that is beyond original rectangle is not redrawing properlyx2
in rapid succession - you can see it draws animated dashed line, but fails to "clear" the canvas. It just draws over existing dashes, resulting in solid line.Is it a bug in Paper.js or am I doing something wrong?
I'm using latest Chrome. Here's a screenshot if you can't reproduce a problem:
Upvotes: 0
Views: 3636
Reputation: 5308
The problem is that you're changing the size of the canvas without letting paper know that is what you've done. Rather than setting canvas size in your resize function, set paper.view.viewSize which will also reset the canvas size.
In the resize function replace
canvas.width = w;
canvas.height = h;
with
paper.view.viewSize.width = w;
paper.view.viewSize.height = h;
This will cause paper to change both the view size and the underlying canvas size - see paperjs.org viewSize doc
Upvotes: 7