mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Move stats update to onFrame handler.
This commit is contained in:
parent
df5c33571f
commit
7b03dbedb9
2 changed files with 3 additions and 2 deletions
|
@ -50,8 +50,6 @@ var CanvasView = View.extend(/** @lends CanvasView# */{
|
||||||
draw: function(checkRedraw) {
|
draw: function(checkRedraw) {
|
||||||
if (checkRedraw && !this._redrawNeeded)
|
if (checkRedraw && !this._redrawNeeded)
|
||||||
return false;
|
return false;
|
||||||
if (this._stats)
|
|
||||||
this._stats.update();
|
|
||||||
// Initial tests conclude that clearing the canvas using clearRect
|
// Initial tests conclude that clearing the canvas using clearRect
|
||||||
// is always faster than setting canvas.width = canvas.width
|
// is always faster than setting canvas.width = canvas.width
|
||||||
// http://jsperf.com/clearrect-vs-setting-width/7
|
// http://jsperf.com/clearrect-vs-setting-width/7
|
||||||
|
|
|
@ -58,6 +58,9 @@ var View = this.View = Base.extend(Callback, /** @lends View# */{
|
||||||
count: count++
|
count: count++
|
||||||
}));
|
}));
|
||||||
before = now;
|
before = now;
|
||||||
|
// Update framerate stats
|
||||||
|
if (that._stats)
|
||||||
|
that._stats.update();
|
||||||
// Automatically draw view on each frame.
|
// Automatically draw view on each frame.
|
||||||
that.draw(true);
|
that.draw(true);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue