mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Have Path#closePath() handle merging of first and last segment, if doubled.
So we finally found a reason for #closePath() to stick around :)
This commit is contained in:
parent
30b7891a1d
commit
5ff911f68c
2 changed files with 7 additions and 1 deletions
|
@ -241,7 +241,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
|
|||
},
|
||||
|
||||
closePath: function() {
|
||||
getCurrentPath(this).setClosed(true);
|
||||
getCurrentPath(this).closePath();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -2202,6 +2202,12 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
},
|
||||
|
||||
closePath: function() {
|
||||
var first = this.getFirstSegment(),
|
||||
last = this.getLastSegment();
|
||||
if (first._point.equals(last._point)) {
|
||||
first.setHandleIn(last._handleIn);
|
||||
last.remove();
|
||||
}
|
||||
this.setClosed(true);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue