From eb70c4de5dcddea8276038ee4275411457a98ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 20 Nov 2011 18:51:34 +0100 Subject: [PATCH] Directly pass matrix argument to _getBounds() instead of whole arguments array. --- src/item/Item.js | 12 ++++++------ src/item/PlacedItem.js | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index ada49dad..90fb0830 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1256,7 +1256,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ * Loops through all children, gets their bounds and finds the bounds around * all of them. */ - _getBounds: function(getter, cacheName, args) { + _getBounds: function(getter, cacheName, matrix) { // Note: We cannot cache these results here, since we do not get // _changed() notifications here for changing geometry in children. // But cacheName is used in sub-classes such as PlacedItem. @@ -1272,7 +1272,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ for (var i = 0, l = children.length; i < l; i++) { var child = children[i]; if (child._visible) { - var rect = child[getter](args[0]); + var rect = child[getter](matrix); x1 = Math.min(rect.x, x1); y1 = Math.min(rect.y, y1); x2 = Math.max(rect.x + rect.width, x2); @@ -1299,7 +1299,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ * @bean */ getBounds: function(/* matrix */) { - return this._getBounds('getBounds', '_bounds', arguments); + return this._getBounds('getBounds', '_bounds', arguments[0]); }, setBounds: function(rect) { @@ -1330,7 +1330,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ * @bean */ getStrokeBounds: function(/* matrix */) { - return this._getBounds('getStrokeBounds', '_strokeBounds', arguments); + return this._getBounds('getStrokeBounds', '_strokeBounds', arguments[0]); }, /** @@ -1340,7 +1340,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ * @bean */ getHandleBounds: function(/* matrix */) { - return this._getBounds('getHandleBounds', '_handleBounds', arguments); + return this._getBounds('getHandleBounds', '_handleBounds', arguments[0]); }, /** @@ -1352,7 +1352,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ * @ignore */ getRoughBounds: function(/* matrix */) { - return this._getBounds('getRoughBounds', '_roughBounds', arguments); + return this._getBounds('getRoughBounds', '_roughBounds', arguments[0]); }, /** diff --git a/src/item/PlacedItem.js b/src/item/PlacedItem.js index 151024d7..bc2c6327 100644 --- a/src/item/PlacedItem.js +++ b/src/item/PlacedItem.js @@ -71,9 +71,8 @@ var PlacedItem = this.PlacedItem = Item.extend(/** @lends PlacedItem# */{ return bounds; }, - _getBounds: function(getter, cacheName, args) { - var matrix = args[0], - useCache = matrix === undefined; + _getBounds: function(getter, cacheName, matrix) { + var useCache = matrix === undefined; if (useCache && this[cacheName]) return this[cacheName]; // Concatenate the passed matrix with the internal one