From ee23877fd19f2f21dc4cc6d883b8952583647f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 1 Jul 2011 12:50:11 +0200 Subject: [PATCH] Move view redrawing from resize handler to #setViewSize(). --- src/ui/View.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ui/View.js b/src/ui/View.js index d8a4da88..87dcdc7f 100644 --- a/src/ui/View.js +++ b/src/ui/View.js @@ -54,15 +54,9 @@ var View = this.View = Base.extend(/** @lends View# */{ if (!DomElement.isInvisible(canvas)) offset = DomElement.getOffset(canvas, false, true); // Set the size now, which internally calls onResize + // and redraws the view that.setViewSize(DomElement.getViewportSize(canvas) .subtract(offset)); - // If there's a _onFrameCallback, call it staight away, - // but without requesting another animation frame. - if (that._onFrameCallback) { - that._onFrameCallback(0, true); - } else { - that.draw(true); - } } }); } else { @@ -151,6 +145,14 @@ var View = this.View = Base.extend(/** @lends View# */{ // Force recalculation this._bounds = null; this._redrawNeeded = true; + if (this._onFrameCallback) { + // If there's a _onFrameCallback, call it staight away, + // but without requesting another animation frame. + this._onFrameCallback(0, true); + } else { + // Otherwise simply redraw the view now + this.draw(true); + } }, /**