mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Make Matrix#orNullIfIdentity() private too, and fix error introduced by previous commit.
This commit is contained in:
parent
d292e08ed2
commit
40551fcacf
4 changed files with 9 additions and 9 deletions
|
@ -486,6 +486,10 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
return new Matrix(this._a, this._c, this._b, this._d, 0, 0);
|
return new Matrix(this._a, this._c, this._b, this._d, 0, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_orNullIfIdentity: function() {
|
||||||
|
return this.isIdentity() ? null : this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Boolean} whether this transform is the identity transform
|
* @return {Boolean} whether this transform is the identity transform
|
||||||
*/
|
*/
|
||||||
|
@ -494,10 +498,6 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
&& this._tx === 0 && this._ty === 0;
|
&& this._tx === 0 && this._ty === 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
orNullIfIdentity: function() {
|
|
||||||
return this.isIdentity() ? null : this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the transform is invertible. A transform is not
|
* Returns whether the transform is invertible. A transform is not
|
||||||
* invertible if the determinant is 0 or any value is non-finite or NaN.
|
* invertible if the determinant is 0 or any value is non-finite or NaN.
|
||||||
|
|
|
@ -879,9 +879,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
// See if we can cache these bounds. We only cache the bounds
|
// See if we can cache these bounds. We only cache the bounds
|
||||||
// transformed with the internally stored _matrix, (the default if no
|
// transformed with the internally stored _matrix, (the default if no
|
||||||
// matrix is passed).
|
// matrix is passed).
|
||||||
matrix = matrix && matrix.orNullIfIdentity();
|
matrix = matrix && matrix._orNullIfIdentity();
|
||||||
// Do not transform by the internal matrix if there is a internalGetter.
|
// Do not transform by the internal matrix if there is a internalGetter.
|
||||||
var _matrix = internalGetter ? null : this._matrix.orNullIfIdentity(),
|
var _matrix = internalGetter ? null : this._matrix._orNullIfIdentity(),
|
||||||
cache = (!matrix || matrix.equals(_matrix)) && getter;
|
cache = (!matrix || matrix.equals(_matrix)) && getter;
|
||||||
// NOTE: This needs to happen before returning cached values, since even
|
// NOTE: This needs to happen before returning cached values, since even
|
||||||
// then, _boundsCache needs to be kept up-to-date.
|
// then, _boundsCache needs to be kept up-to-date.
|
||||||
|
|
|
@ -2770,7 +2770,7 @@ statics: {
|
||||||
return Path.getBounds(segments, closed, style, matrix);
|
return Path.getBounds(segments, closed, style, matrix);
|
||||||
var length = segments.length - (closed ? 0 : 1),
|
var length = segments.length - (closed ? 0 : 1),
|
||||||
radius = style.getStrokeWidth() / 2,
|
radius = style.getStrokeWidth() / 2,
|
||||||
padding = Path._getPenPadding(radius, matrix),
|
padding = Path._getStrokePadding(radius, matrix),
|
||||||
bounds = Path.getBounds(segments, closed, style, matrix, padding),
|
bounds = Path.getBounds(segments, closed, style, matrix, padding),
|
||||||
join = style.getStrokeJoin(),
|
join = style.getStrokeJoin(),
|
||||||
cap = style.getStrokeCap(),
|
cap = style.getStrokeCap(),
|
||||||
|
|
|
@ -69,9 +69,9 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
// NOTE: The hidden argument _matrix is used internally to override the
|
// NOTE: The hidden argument _matrix is used internally to override the
|
||||||
// passed path's transformation matrix.
|
// passed path's transformation matrix.
|
||||||
var self = this === path || !path, // self-intersections?
|
var self = this === path || !path, // self-intersections?
|
||||||
matrix1 = this._matrix.orNullIfIdentity(),
|
matrix1 = this._matrix._orNullIfIdentity(),
|
||||||
matrix2 = self ? matrix1
|
matrix2 = self ? matrix1
|
||||||
: (_matrix || path._matrix).orNullIfIdentity();
|
: (_matrix || path._matrix)._orNullIfIdentity();
|
||||||
// First check the bounds of the two paths. If they don't intersect,
|
// First check the bounds of the two paths. If they don't intersect,
|
||||||
// we don't need to iterate through their curves.
|
// we don't need to iterate through their curves.
|
||||||
if (!self && !this.getBounds(matrix1).touches(path.getBounds(matrix2)))
|
if (!self && !this.getBounds(matrix1).touches(path.getBounds(matrix2)))
|
||||||
|
|
Loading…
Reference in a new issue