commit c72651143bc6b92d09fea4cba50c42af81e939d0
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2015-09-27T23:16:49Z |
| subject | broken style when MessageBox overflow |
commit c72651143bc6b92d09fea4cba50c42af81e939d0
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2015-09-27T23:16:49Z
broken style when MessageBox overflow
---
botanjs/src/Components/MessageBox.css | 10 ++++++++++
botanjs/src/Components/MessageBox.js | 18 +++++++++++++++---
botanjs/src/System/Cycle/Trigger.js | 4 +++-
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/botanjs/src/Components/MessageBox.css b/botanjs/src/Components/MessageBox.css
index fa27056..b0702ae 100644
--- a/botanjs/src/Components/MessageBox.css
+++ b/botanjs/src/Components/MessageBox.css
@@ -11,8 +11,10 @@
.mbox_body {
min-width: 350px;
min-height: 100px;
+
max-width: 800px;
max-height: 600px;
+
position: absolute;
background-color: rgba( 0, 0, 0, 0.8 );
@@ -34,6 +36,7 @@
font-family: sans-serif;
color: white;
+ overflow: hidden;
/*
-moz-box-shadow: inset 0 10px 10px -10px black;
-webkit-box-shadow: inset 0 10px 10px -10px black;
@@ -41,6 +44,13 @@
*/
}
+.mbox-inners {
+ /* This is to hide the scrollbar */
+ padding-right: 50%;
+ margin-right: -50%;
+ overflow-y: scroll;
+}
+
.mbox_buttons {
text-align: right;
padding: 1em 0.5em;
diff --git a/botanjs/src/Components/MessageBox.js b/botanjs/src/Components/MessageBox.js
index f628eaa..400db89 100644
--- a/botanjs/src/Components/MessageBox.js
+++ b/botanjs/src/Components/MessageBox.js
@@ -79,8 +79,8 @@
"mbox_body cubic500"
, [
Dand.wrapc( "mbox_titlebar flsf", title )
- , Dand.wrapc( "mbox_content", content )
- , Dand.wrapc( "mbox_buttons", no ? [ _yes, _no ] : _yes )
+ , Dand.wrapc( "mbox_content", this.innerBox = Dand.wrapc( "mbox-inners", content ) )
+ , this.buttonBox = Dand.wrapc( "mbox_buttons", no ? [ _yes, _no ] : _yes )
]
)
);
@@ -106,9 +106,21 @@
, function()
{
m_style.transition = m_style.minHeight = m_style.height = m_style.overflow = "";
- m_style.marginTop = String( -0.5 * this.mbox.clientHeight ) + "px";
+
+ var bBox = this.buttonBox;
+ var mHeight = this.mbox.clientHeight;
+ var innerHeight = this.innerBox.clientHeight;
+ var bBoxHeight = bBox.clientHeight;
+
+ m_style.marginTop = ( -0.5 * mHeight ) + "px";
m_style.opacity = 1;
+ if( mHeight < ( bBox.getBoundingClientRect().y - bBox.parentNode.getBoundingClientRect().y + bBoxHeight ) )
+ {
+ m_style.height = "100%";
+ this.innerBox.style.maxHeight = ( innerHeight - bBoxHeight ) + "px"
+ }
+
}.bind( this )
);
diff --git a/botanjs/src/System/Cycle/Trigger.js b/botanjs/src/System/Cycle/Trigger.js
index 6d6529c..1136d4d 100644
--- a/botanjs/src/System/Cycle/Trigger.js
+++ b/botanjs/src/System/Cycle/Trigger.js
@@ -2,7 +2,9 @@
var ns = __namespace( "System.Cycle.Trigger" );
/** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
+ var Cycle = __import( "System.Cycle" );
+ /** @type {System.Debug} */
+ var debug = __import( "System.Debug" );
// trigger list
var tList = [];