diff --git a/src/document/Document.js b/src/document/Document.js index 9cd801ca..977001f7 100644 --- a/src/document/Document.js +++ b/src/document/Document.js @@ -65,6 +65,18 @@ var Document = this.Document = Base.extend({ this.views = [this.activeView]; this._selectedItems = {}; this._selectedItemCount = 0; + // TODO: test this on IE: + if (this.canvas.attributes.stats) { + this.stats = new Stats(); + // Align top-left to the canvas + var element = this.stats.domElement, + style = element.style, + offset = Element.getOffset(this.canvas); + style.position = 'absolute'; + style.left = offset.x + 'px'; + style.top = offset.y + 'px'; + document.body.appendChild(element); + } }, getSize: function() { @@ -144,6 +156,8 @@ var Document = this.Document = Base.extend({ draw: function() { if (this.canvas) { + if (this.stats) + this.stats.update(); var ctx = this.context; ctx.save(); diff --git a/src/load.js b/src/load.js index 3fec896e..997d5823 100644 --- a/src/load.js +++ b/src/load.js @@ -72,7 +72,9 @@ var sources = [ 'src/util/Numerical.js', 'src/util/PaperScript.js', - 'src/ui/Key.js' + 'src/ui/Key.js', + + 'lib/Stats.js' ]; // Load unit tests after library if asked to do so