From 82ef06212b0aaf1dc4192e9e0bafac5156a6bb1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 19 Jun 2011 17:46:39 +0100 Subject: [PATCH] Shorten #_getBounds() code. --- src/item/Item.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index eef3c729..b14001c4 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1024,13 +1024,12 @@ var Item = this.Item = Base.extend({ var x1 = Infinity, x2 = -Infinity, y1 = x1, - y2 = x2; + y2 = x2, + getBounds = includeStroke ? 'getStrokeBounds' : 'getBounds'; for (var i = 0, l = children.length; i < l; i++) { var child = children[i]; if (child._visible) { - var rect = includeStroke - ? child.getStrokeBounds() - : child.getBounds(); + var rect = child[getBounds](); x1 = Math.min(rect.x, x1); y1 = Math.min(rect.y, y1); x2 = Math.max(rect.x + rect.width, x2);