mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Imlement Stats in the dev version of Paper.
This commit is contained in:
parent
7e24a9170f
commit
140f7dee44
2 changed files with 17 additions and 1 deletions
|
@ -65,6 +65,18 @@ var Document = this.Document = Base.extend({
|
||||||
this.views = [this.activeView];
|
this.views = [this.activeView];
|
||||||
this._selectedItems = {};
|
this._selectedItems = {};
|
||||||
this._selectedItemCount = 0;
|
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() {
|
getSize: function() {
|
||||||
|
@ -144,6 +156,8 @@ var Document = this.Document = Base.extend({
|
||||||
|
|
||||||
draw: function() {
|
draw: function() {
|
||||||
if (this.canvas) {
|
if (this.canvas) {
|
||||||
|
if (this.stats)
|
||||||
|
this.stats.update();
|
||||||
var ctx = this.context;
|
var ctx = this.context;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,9 @@ var sources = [
|
||||||
'src/util/Numerical.js',
|
'src/util/Numerical.js',
|
||||||
'src/util/PaperScript.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
|
// Load unit tests after library if asked to do so
|
||||||
|
|
Loading…
Reference in a new issue