mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix PaperScope#install() so classes actually get injected.
This commit is contained in:
parent
a8c08b3301
commit
14895f412c
2 changed files with 12 additions and 6 deletions
|
@ -137,12 +137,15 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Use scope as side-car (= 'this' inside iterator), and have it
|
// Copy over all fields from this scope to the destination.
|
||||||
// returned at the end.
|
// Do not use Base.each, since we also want to enumerate over
|
||||||
return Base.each(this, function(value, key) {
|
// fields on PaperScope.prototype, e.g. all classes
|
||||||
if (!(key in this))
|
for (var key in this) {
|
||||||
this[key] = value;
|
if (!/^(version|_id|load)/.test(key) && !(key in scope)) {
|
||||||
}, scope);
|
console.log(key);
|
||||||
|
scope[key] = this[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -127,6 +127,9 @@ var paper = new function() {
|
||||||
// the first PaperScope and return it, all in one statement.
|
// the first PaperScope and return it, all in one statement.
|
||||||
// The version for 'dev' of this happens in core/initialize.js, since it depends
|
// The version for 'dev' of this happens in core/initialize.js, since it depends
|
||||||
// on sequentiality of include() loading.
|
// on sequentiality of include() loading.
|
||||||
|
// Mark this object as enumerable, so all the injected classes can be enumerated
|
||||||
|
// again in PaperScope#install().
|
||||||
|
this.enumerable = true;
|
||||||
return new (PaperScope.inject(this));
|
return new (PaperScope.inject(this));
|
||||||
/*#*/ } // options.version != 'dev'
|
/*#*/ } // options.version != 'dev'
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue