mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
parent
6562f861ab
commit
1803cd216a
1 changed files with 11 additions and 8 deletions
|
@ -1250,7 +1250,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* Joins the path with the specified path, which will be removed in the
|
* Joins the path with the specified path, which will be removed in the
|
||||||
* process.
|
* process.
|
||||||
*
|
*
|
||||||
* @param {Path} path
|
* @param {Path} path the path to join this path with
|
||||||
|
* @return {Path} the joined path
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Joining two paths:
|
* // Joining two paths:
|
||||||
|
@ -1316,19 +1317,20 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
var segments = path._segments,
|
var segments = path._segments,
|
||||||
last1 = this.getLastSegment(),
|
last1 = this.getLastSegment(),
|
||||||
last2 = path.getLastSegment();
|
last2 = path.getLastSegment();
|
||||||
if (last1._point.equals(last2._point))
|
if (!last2) // an empty path?
|
||||||
|
return this;
|
||||||
|
if (last1 && last1._point.equals(last2._point))
|
||||||
path.reverse();
|
path.reverse();
|
||||||
var first1,
|
var first2 = path.getFirstSegment();
|
||||||
first2 = path.getFirstSegment();
|
if (last1 && last1._point.equals(first2._point)) {
|
||||||
if (last1._point.equals(first2._point)) {
|
|
||||||
last1.setHandleOut(first2._handleOut);
|
last1.setHandleOut(first2._handleOut);
|
||||||
this._add(segments.slice(1));
|
this._add(segments.slice(1));
|
||||||
} else {
|
} else {
|
||||||
first1 = this.getFirstSegment();
|
var first1 = this.getFirstSegment();
|
||||||
if (first1._point.equals(first2._point))
|
if (first1 && first1._point.equals(first2._point))
|
||||||
path.reverse();
|
path.reverse();
|
||||||
last2 = path.getLastSegment();
|
last2 = path.getLastSegment();
|
||||||
if (first1._point.equals(last2._point)) {
|
if (first1 && first1._point.equals(last2._point)) {
|
||||||
first1.setHandleIn(last2._handleIn);
|
first1.setHandleIn(last2._handleIn);
|
||||||
// Prepend all segments from path except the last one
|
// Prepend all segments from path except the last one
|
||||||
this._add(segments.slice(0, segments.length - 1), 0);
|
this._add(segments.slice(0, segments.length - 1), 0);
|
||||||
|
@ -1351,6 +1353,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
last.remove();
|
last.remove();
|
||||||
this.setClosed(true);
|
this.setClosed(true);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue