mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-28 22:08:54 -04:00
Rename CompoundPath#simplify() to #flatten() to avoid clashes with Path#simplify(), and add Path#flatten(), returning itself.
This commit is contained in:
parent
93447ee533
commit
fd8fe9c08e
3 changed files with 11 additions and 3 deletions
|
@ -69,9 +69,9 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
|
||||||
* the path is moved outside and the compound path is erased.
|
* the path is moved outside and the compound path is erased.
|
||||||
* Otherwise, the compound path is returned unmodified.
|
* Otherwise, the compound path is returned unmodified.
|
||||||
*
|
*
|
||||||
* @return {CompoundPath|Path} the simplified compound path
|
* @return {CompoundPath|Path} the flattened compound path
|
||||||
*/
|
*/
|
||||||
simplify: function() {
|
flatten: function() {
|
||||||
if (this._children.length == 1) {
|
if (this._children.length == 1) {
|
||||||
var child = this._children[0];
|
var child = this._children[0];
|
||||||
child.insertAbove(this);
|
child.insertAbove(this);
|
||||||
|
|
|
@ -947,6 +947,14 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For simple paths, flatten always returns the path itself. See
|
||||||
|
* {@link CompoundPath#flatten()} for more explanations.
|
||||||
|
*/
|
||||||
|
flatten: function() {
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The length of the perimeter of the path.
|
* The length of the perimeter of the path.
|
||||||
*
|
*
|
||||||
|
|
|
@ -317,7 +317,7 @@ var SvgImporter = this.SvgImporter = new function() {
|
||||||
break;
|
break;
|
||||||
// http://www.w3.org/TR/SVG/masking.html#ClipPathProperty
|
// http://www.w3.org/TR/SVG/masking.html#ClipPathProperty
|
||||||
case 'clip-path':
|
case 'clip-path':
|
||||||
var clipPath = getDefinition(value).clone().simplify(),
|
var clipPath = getDefinition(value).clone().flatten(),
|
||||||
group = new Group([clipPath, item]);
|
group = new Group([clipPath, item]);
|
||||||
group.clipped = true;
|
group.clipped = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue