mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Reducing an empty CompoundPath should replace it with an empty Path.
This commit is contained in:
parent
e195db2567
commit
5e654ca64e
1 changed files with 12 additions and 0 deletions
|
@ -131,6 +131,18 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
|||
this._children[i].smooth();
|
||||
},
|
||||
|
||||
reduce: function reduce() {
|
||||
if (this._children.length === 0) { // Replace with a simple empty Path
|
||||
var path = new Path(Item.NO_INSERT);
|
||||
path.insertAbove(this);
|
||||
path.setStyle(this._style);
|
||||
this.remove();
|
||||
return path;
|
||||
} else {
|
||||
return reduce.call(this);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Specifies whether the compound path is oriented clock-wise.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue