mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Doc: Change comment about using canvas.width = canvas.width instead of context.clearRect.
This commit is contained in:
parent
8cf2f54d5f
commit
1a6c5c8c6f
1 changed files with 4 additions and 3 deletions
|
@ -29,9 +29,10 @@ Doc = Base.extend({
|
||||||
|
|
||||||
redraw: function() {
|
redraw: function() {
|
||||||
if (this.canvas) {
|
if (this.canvas) {
|
||||||
// TODO: clearing the canvas by setting
|
// Initial tests conclude that clearing the canvas is always
|
||||||
// this.canvas.width = this.canvas.width might be faster..
|
// faster than using clearRect:
|
||||||
this.ctx.clearRect(0, 0, this.size.width + 1, this.size.height);
|
// http://jsperf.com/clearrect-vs-setting-width/7
|
||||||
|
this.ctx.clearRect(0, 0, this.size.width + 1, this.size.height + 1);
|
||||||
for (var i = 0, l = this.layers.length; i < l; i++) {
|
for (var i = 0, l = this.layers.length; i < l; i++) {
|
||||||
this.layers[i].draw(this.ctx, {});
|
this.layers[i].draw(this.ctx, {});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue