mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Implement CompoundPath#getLength()
This commit is contained in:
parent
08a23e3318
commit
4d9c0c9f05
1 changed files with 15 additions and 0 deletions
|
@ -283,6 +283,21 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
|||
for (var i = 0, l = children.length; i < l; i++)
|
||||
area += children[i].getArea();
|
||||
return area;
|
||||
},
|
||||
|
||||
/**
|
||||
* The total length of all sub-paths in this compound-path, calculated by
|
||||
* getting {@link Path#getLength()} of each sub-path and it adding up.
|
||||
*
|
||||
* @bean
|
||||
* @type Number
|
||||
*/
|
||||
getLength: function() {
|
||||
var children = this._children,
|
||||
length = 0;
|
||||
for (var i = 0, l = children.length; i < l; i++)
|
||||
length += children[i].getLength();
|
||||
return length;
|
||||
}
|
||||
}, /** @lends CompoundPath# */{
|
||||
// Enforce bean creation for getPathData(), as it has hidden parameters.
|
||||
|
|
Loading…
Reference in a new issue