mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Fix bug in Segment#_transformCoordinates, where handles were not set when they were zero, change was false and no matrix was provided.
This commit is contained in:
parent
7e26a7af1e
commit
3eecb924c8
1 changed files with 36 additions and 32 deletions
|
@ -332,13 +332,15 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
|
|||
// points for largely improved performance, as no calls to
|
||||
// Point.read() and Point constructors are necessary.
|
||||
var point = this._point,
|
||||
// If a matrix is defined, only transform handles if they are set.
|
||||
// This saves some computation time. If no matrix is set, always
|
||||
// If change is true, only transform handles if they are set, as
|
||||
// _transformCoordinates is called only to change the segment, no
|
||||
// to receive the coords.
|
||||
// This saves some computation time. If change is false, always
|
||||
// use the real handles, as we just want to receive a filled
|
||||
// coords array for getBounds().
|
||||
handleIn = !matrix || !this._handleIn.isZero()
|
||||
handleIn = !change || !this._handleIn.isZero()
|
||||
? this._handleIn : null,
|
||||
handleOut = !matrix || !this._handleOut.isZero()
|
||||
handleOut = !change || !this._handleOut.isZero()
|
||||
? this._handleOut : null,
|
||||
x = point._x,
|
||||
y = point._y,
|
||||
|
@ -355,7 +357,10 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
|
|||
coords[i++] = handleOut._x + x;
|
||||
coords[i++] = handleOut._y + y;
|
||||
}
|
||||
if (matrix) {
|
||||
// If no matrix was previded, this was just called to get the coords and
|
||||
// we are done now.
|
||||
if (!matrix)
|
||||
return;
|
||||
matrix._transformCoordinates(coords, 0, coords, 0, i / 2);
|
||||
x = coords[0];
|
||||
y = coords[1];
|
||||
|
@ -385,5 +390,4 @@ var Segment = this.Segment = Base.extend(/** @lends Segment# */{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue