mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Fix issue with Curve#divide() where the wrong curve reference is returned.
This commit is contained in:
parent
532176ac62
commit
2230c2888d
1 changed files with 7 additions and 2 deletions
|
@ -344,12 +344,17 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
||||||
if (this._path) {
|
if (this._path) {
|
||||||
// Insert at the end if this curve is a closing curve of a
|
// Insert at the end if this curve is a closing curve of a
|
||||||
// closed path, since otherwise it would be inserted at 0.
|
// closed path, since otherwise it would be inserted at 0.
|
||||||
if (this._segment1._index > 0 && this._segment2._index == 0) {
|
if (this._segment1._index > 0 && this._segment2._index === 0) {
|
||||||
this._path.add(segment);
|
this._path.add(segment);
|
||||||
} else {
|
} else {
|
||||||
this._path.insert(this._segment2._index, segment);
|
this._path.insert(this._segment2._index, segment);
|
||||||
}
|
}
|
||||||
res = this.getNext();
|
// The way Path#_add handles curves, this curve will always
|
||||||
|
// become the owner of the newly inserted segment.
|
||||||
|
// TODO: I expect this.getNext() to produce the correct result,
|
||||||
|
// but since we're inserting differently in _add (something
|
||||||
|
// linked with CurveLocation#dividie()), this is not the case...
|
||||||
|
res = this;
|
||||||
} else {
|
} else {
|
||||||
// otherwise create it from the result of split
|
// otherwise create it from the result of split
|
||||||
var end = this._segment2;
|
var end = this._segment2;
|
||||||
|
|
Loading…
Reference in a new issue