mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fold applyAttribute() into applyAttributes().
This commit is contained in:
parent
417cfde795
commit
6571c28256
1 changed files with 1 additions and 19 deletions
|
@ -392,24 +392,6 @@ new function() {
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Parses an SVG style attibute and applies it to a Paper.js item.
|
||||
*
|
||||
* @param {SVGSVGElement} node an SVG node
|
||||
* @param {Item} item the item to apply the style or attribute to.
|
||||
* @param {String} name an SVG style name
|
||||
* @param value the value of the SVG style
|
||||
*/
|
||||
function applyAttribute(item, value, name, node) {
|
||||
var attribute;
|
||||
if (value != null && (attribute = attributes[name])) {
|
||||
var res = attribute(item, value, name, node);
|
||||
if (res !== undefined)
|
||||
item = res;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts various SVG styles and attributes into Paper.js styles and
|
||||
* attributes and applies them to the passed item.
|
||||
|
@ -438,7 +420,7 @@ new function() {
|
|||
value = null;
|
||||
}
|
||||
if (value)
|
||||
item = applyAttribute(item, value, key, node);
|
||||
item = Base.pick(apply(item, value, key, node), item);
|
||||
});
|
||||
return item;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue