From 9cca5b2c8e98e441dbc73ff04e11620bd13f6db1 Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Thu, 26 Jun 2014 00:28:09 +0200 Subject: [PATCH] Only bubble up _update if it is called by getBoundingRect. --- src/group.js | 2 +- src/polygon.js | 2 +- src/shape.js | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/group.js b/src/group.js index f93aca254..da54c4c64 100644 --- a/src/group.js +++ b/src/group.js @@ -324,7 +324,7 @@ var rect; // TODO: Update this to not __always__ update. Just when it needs to. - this._update(); + this._update(true); // Variables need to be defined here, because of nested nature of groups. var left = Infinity, right = -Infinity, diff --git a/src/polygon.js b/src/polygon.js index 698f5d0de..324b52cee 100644 --- a/src/polygon.js +++ b/src/polygon.js @@ -373,7 +373,7 @@ getBoundingClientRect: function(shallow) { // TODO: Update this to not __always__ update. Just when it needs to. - this._update(); + this._update(true); var matrix = !!shallow ? this._matrix : getComputedMatrix(this); diff --git a/src/shape.js b/src/shape.js index 385f1a5b0..e9994b16c 100644 --- a/src/shape.js +++ b/src/shape.js @@ -114,7 +114,7 @@ * To be called before render that calculates and collates all information * to be as up-to-date as possible for the render. Called once a frame. */ - _update: function() { + _update: function(deep) { if (!this._matrix.manual && this._flagMatrix) { this._matrix @@ -125,9 +125,11 @@ } - // Bubble up to parents mainly for `getBoundingClientRect` method. - if (this.parent && this.parent._update) { - this.parent._update(); + if (deep) { + // Bubble up to parents mainly for `getBoundingClientRect` method. + if (this.parent && this.parent._update) { + this.parent._update(); + } } return this;