Change scoped compilation of paper so that only a populated paper object is returned to the global scope, but nothing is installed yet.

This commit is contained in:
Jürg Lehni 2011-03-03 16:57:29 +00:00
parent a543801598
commit 5508e6eab6
2 changed files with 7 additions and 8 deletions

View file

@ -1,4 +1,4 @@
(function(scope) {
var paper = new function() {
#include "paper.js"
@ -39,7 +39,6 @@
#include "util/CanvasProvider.js"
#include "util/MathUtils.js"
paper.populate();
paper.install(scope);
return paper.populate();
})(this);
};

View file

@ -4,15 +4,15 @@ var paper = {
populate: function() {
// Inject all prototypes from the paper scope into the paper object.
Base.each(['Point', 'Size', 'Rectangle', 'Matrix', 'DocumentView',
// return this so build.js can use 'return paper.populate()'.
return Base.each(['Point', 'Size', 'Rectangle', 'Matrix', 'DocumentView',
'Doc', 'Symbol', 'Item', 'Group', 'Layer', 'Raster', 'PlacedSymbol',
'PathStyle', 'Segment', 'Curve', 'PathItem', 'Path', 'CompoundPath',
'Color', 'RGBColor', 'GrayColor', 'GradientColor', 'Gradient',
'GradientStop', 'ToolEvent', 'ToolHandler', 'Tool'],
function(name) {
paper[name] = eval(name);
}
);
this[name] = eval(name);
}, this);
},
install: function(scope) {