mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Further optimise PathStyle code.
This commit is contained in:
parent
23a29ced98
commit
7334e824f5
1 changed files with 8 additions and 7 deletions
|
@ -48,15 +48,16 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
|
|||
};
|
||||
|
||||
Item.inject(Base.each(keys, function(key) {
|
||||
var isColor = !!(key.match(/Color$/)),
|
||||
set = 'set' + Base.capitalize(key),
|
||||
get = 'get' + Base.capitalize(key);
|
||||
var isColor = !!key.match(/Color$/),
|
||||
part = Base.capitalize(key),
|
||||
set = 'set' + part,
|
||||
get = 'get' + part;
|
||||
|
||||
fields[set] = function(value) {
|
||||
if (this._item && this._item.children) {
|
||||
for (var i = 0, l = this._item.children.length; i < l; i++) {
|
||||
this._item.children[i]._style[set](value);
|
||||
}
|
||||
var children = this._item && this._item.children;
|
||||
if (children) {
|
||||
for (var i = 0, l = children.length; i < l; i++)
|
||||
children[i]._style[set](value);
|
||||
} else {
|
||||
this['_' + key] = isColor ? Color.read(arguments) : value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue