From 40551fcacf8f64b15789403bd500114a99151479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 17 Jan 2016 19:34:54 +0100 Subject: [PATCH] Make Matrix#orNullIfIdentity() private too, and fix error introduced by previous commit. --- src/basic/Matrix.js | 8 ++++---- src/item/Item.js | 4 ++-- src/path/Path.js | 2 +- src/path/PathItem.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 7d33fbc3..485ea730 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -486,6 +486,10 @@ var Matrix = Base.extend(/** @lends Matrix# */{ 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 */ @@ -494,10 +498,6 @@ var Matrix = Base.extend(/** @lends Matrix# */{ && this._tx === 0 && this._ty === 0; }, - orNullIfIdentity: function() { - return this.isIdentity() ? null : this; - }, - /** * Returns whether the transform is invertible. A transform is not * invertible if the determinant is 0 or any value is non-finite or NaN. diff --git a/src/item/Item.js b/src/item/Item.js index aa236972..fe91943c 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -879,9 +879,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ // See if we can cache these bounds. We only cache the bounds // transformed with the internally stored _matrix, (the default if no // matrix is passed). - matrix = matrix && matrix.orNullIfIdentity(); + matrix = matrix && matrix._orNullIfIdentity(); // 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; // NOTE: This needs to happen before returning cached values, since even // then, _boundsCache needs to be kept up-to-date. diff --git a/src/path/Path.js b/src/path/Path.js index 9baa1cfb..84640bff 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -2770,7 +2770,7 @@ statics: { return Path.getBounds(segments, closed, style, matrix); var length = segments.length - (closed ? 0 : 1), radius = style.getStrokeWidth() / 2, - padding = Path._getPenPadding(radius, matrix), + padding = Path._getStrokePadding(radius, matrix), bounds = Path.getBounds(segments, closed, style, matrix, padding), join = style.getStrokeJoin(), cap = style.getStrokeCap(), diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 06e1105f..376a5131 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -69,9 +69,9 @@ var PathItem = Item.extend(/** @lends PathItem# */{ // NOTE: The hidden argument _matrix is used internally to override the // passed path's transformation matrix. var self = this === path || !path, // self-intersections? - matrix1 = this._matrix.orNullIfIdentity(), + matrix1 = this._matrix._orNullIfIdentity(), matrix2 = self ? matrix1 - : (_matrix || path._matrix).orNullIfIdentity(); + : (_matrix || path._matrix)._orNullIfIdentity(); // First check the bounds of the two paths. If they don't intersect, // we don't need to iterate through their curves. if (!self && !this.getBounds(matrix1).touches(path.getBounds(matrix2)))