From aa38487f9f143be722cfd2b86f58d32c8b2bf77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sun, 6 Mar 2016 23:26:15 +0800 Subject: [PATCH] Allow MessageBox to be updated via show --- botanjs/src/Components/MessageBox.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/botanjs/src/Components/MessageBox.js b/botanjs/src/Components/MessageBox.js index b004115..9dea0ce 100644 --- a/botanjs/src/Components/MessageBox.js +++ b/botanjs/src/Components/MessageBox.js @@ -88,13 +88,21 @@ ] ) ); + + this.showned = false; }; MessageBox.prototype.setHandler = function( handler ) { this.clickHandler = handler }; MessageBox.prototype.show = function () { - document.body.appendChild( this.stage ); + var update = this.showned; + if( !update ) + { + this.showned = true; + document.body.appendChild( this.stage ); + } + // Center the box var m_style = this.mbox.style; @@ -103,6 +111,7 @@ m_style.marginLeft = String( -0.5 * this.mbox.clientWidth ) + "px"; m_style.overflow = "hidden"; m_style.minHeight = m_style.opacity = m_style.height = 0; + // The interval in firefox seems independent to etablishing element style // using heightTriggers-hack instead var by = function( el ) @@ -110,11 +119,13 @@ var tRect = el.getBoundingClientRect(); return tRect.y || tRect.top; }; + var bh = function( el ) { var tRect = el.getBoundingClientRect(); return tRect.height; }; + Trigger.height( this.mbox, 0 , function()