mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -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++)
|
for (var i = 0, l = children.length; i < l; i++)
|
||||||
area += children[i].getArea();
|
area += children[i].getArea();
|
||||||
return area;
|
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# */{
|
}, /** @lends CompoundPath# */{
|
||||||
// Enforce bean creation for getPathData(), as it has hidden parameters.
|
// Enforce bean creation for getPathData(), as it has hidden parameters.
|
||||||
|
|
Loading…
Reference in a new issue