mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Minor code clean-up.
This commit is contained in:
parent
8cea919dbd
commit
a10e44d601
1 changed files with 5 additions and 7 deletions
|
@ -216,16 +216,15 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
this._closed = closed;
|
||||
// Update _curves length
|
||||
if (this._curves) {
|
||||
var length = this._segments.length,
|
||||
i;
|
||||
var length = this._segments.length;
|
||||
// Reduce length by one if it's an open path:
|
||||
if (!closed && length > 0)
|
||||
length--;
|
||||
this._curves.length = length;
|
||||
// If we were closing this path, we need to add a new curve now
|
||||
if (closed)
|
||||
this._curves[i = length - 1] = Curve.create(this,
|
||||
this._segments[i], this._segments[0]);
|
||||
this._curves[length - 1] = Curve.create(this,
|
||||
this._segments[length - 1], this._segments[0]);
|
||||
}
|
||||
this._changed(/*#=*/ Change.GEOMETRY);
|
||||
}
|
||||
|
@ -288,9 +287,8 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
var segment = segs[i];
|
||||
// If the segments belong to another path already, clone them before
|
||||
// adding:
|
||||
if (segment._path) {
|
||||
segment = segs[i] = new Segment(segment);
|
||||
}
|
||||
if (segment._path)
|
||||
segment = segs[i] = segment.clone();
|
||||
segment._path = this;
|
||||
segment._index = index + i;
|
||||
// Select newly added segments if path was fully selected before
|
||||
|
|
Loading…
Reference in a new issue