OSDN Git Service

Version 0.6.140, fix size detection @IE.
authoritozyun <itozyun@user.sourceforge.jp>
Sat, 18 Apr 2015 06:22:16 +0000 (15:22 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Sat, 18 Apr 2015 06:22:16 +0000 (15:22 +0900)
0.6.x/css/xui.css
0.6.x/js/02_dom/03_XDomEvent.js
0.6.x/js/20_ui/06_AbstractUINode.js
0.6.x/js/20_ui/15_ScrollBox.js
0.6.x/js/main.js

index 5ec74e3..2cec8d3 100644 (file)
@@ -1,14 +1,30 @@
-html, body {\r
-       margin   : 0;\r
-       padding  : 0;\r
-       width    : 100%;\r
-       height   : 100%;\r
-       overflow : hidden;\r
-}\r
+\r
+       html {\r
+               font-size                : 100%; /* 1 */\r
+               -webkit-text-size-adjust : 100%; /* 2 */\r
+                  -moz-text-size-adjust : 100%; /* 2 */\r
+                   -ms-text-size-adjust : 100%; /* 2 */\r
+                       text-size-adjust : 100%; /* 2 */\r
+       }\r
+       \r
+\r
+\r
+       html,\r
+       body {\r
+               width    : 100%;\r
+               height   : 100%;\r
+               overflow : hidden;\r
+               margin      : 0;\r
+               padding     : 0;/* opera 8 */\r
+               border      : 0;\r
+       }\r
+\r
+       body {\r
+               font-size : 16px; /* px 指定しないと ie8- で要素のサイズが狂う */\r
+       }\r
 \r
 .PageRoot {\r
        height   : 100%;\r
-       position : relative;\r
 }\r
 \r
 .PageRoot,\r
@@ -23,6 +39,8 @@ html, body {
        margin             : 0;\r
 /* ブラウザのレイアウト機能による auto なサイズ指定は行わない */\r
        overflow           : hidden;\r
+\r
+\r
 /* border-box がデフォルト \r
        box-sizing         : border-box;\r
        -o-box-sizing      : border-box;\r
index 6ba81c8..bcfe934 100644 (file)
@@ -435,11 +435,10 @@ if( !navigator.pointerEnabled ){
                X_Event_Rename[ 'pointerdown'     ] = 'mousedown';\r
                X_Event_Rename[ 'pointerup'       ] = 'mouseup';\r
                X_Event_Rename[ 'pointermove'     ] = 'mousemove';\r
-               X_Event_Rename[ 'pointercancel'   ] = 'mouseleave';//??\r
+               X_Event_Rename[ 'pointercancel'   ] = document.documentElement.onmouseleave !== undefined ? 'mouseleave' : 'mouseout';//??\r
                \r
                // Opera は ブラウザ設定から右クリックの通知を許可すると mousedown で e.button==2 が返る,キャンセルは可能??\r
-               X_UA[ 'Opera' ] && (\r
-               X_Event_Rename[ 'contextmenu'     ] = 'mousedown' );\r
+               X_UA[ 'Opera' ] && ( X_Event_Rename[ 'contextmenu'     ] = 'mousedown' );\r
                \r
                /*\r
                 * buttons の無いブラウザには mouseup, mousedown を監視して、buttons フラグを更新し続ける\r
index f649cd5..9004773 100644 (file)
@@ -393,7 +393,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                        contentW = XUI_AbstractUINode_calcFinalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW );                                  \r
                                };\r
                                this.contentWidth = contentW + boxMinus;\r
-                               this.scrollWidth  = this.contentWidth + this.contentL + this.contentR;\r
+                               //this.scrollWidth  = this.contentWidth + this.contentL + this.contentR;\r
                                this.boxWidth     = contentW - boxMinus + this.contentL + this.contentR;\r
                                this.boxSizingOffsetLR = boxMinus;\r
                                delete this.minContentWidth;\r
@@ -401,9 +401,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                delete this.minBoxWidth;\r
                                delete this.maxBoxWidth;\r
                        } else {        \r
-                               this.minContentWidth = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus;\r
-                               this.maxContentWidth = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus;\r
-                               this.scrollWidth     = this.contentWidth + this.contentL + this.contentR;\r
+                               this.minContentWidth = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus );\r
+                               this.maxContentWidth = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus );\r
+                               //this.scrollWidth     = this.contentWidth + this.contentL + this.contentR;\r
                                this.minBoxWidth     = this.minContentWidth - boxMinus + this.contentL + this.contentR;\r
                                this.maxBoxWidth     = this.maxContentWidth - boxMinus + this.contentL + this.contentR;\r
                                //delete this.contentWidth;\r
@@ -435,7 +435,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                        contentH = XUI_AbstractUINode_calcFinalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH );\r
                                };                      \r
                                this.contentHeight = contentH + boxMinus;\r
-                               this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
+                               //this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
                                this.boxHeight     = contentH - boxMinus + this.contentT + this.contentB; // padding-box の場合 border だけ足される\r
                                this.boxSizingOffsetTB = boxMinus;\r
                                delete this.minContentHeight;\r
@@ -443,8 +443,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                delete this.minBoxHeight;\r
                                delete this.maxBoxHeight;\r
                        } else {\r
-                               this.minContentHeight = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus;\r
-                               this.maxContentHeight = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus;                           \r
+                               this.minContentHeight = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus );\r
+                               this.maxContentHeight = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus );                                \r
                                this.minBoxHeight = this.minContentHeight - boxMinus + this.contentT + this.contentB;\r
                                this.maxBoxHeight = this.maxContentHeight - boxMinus + this.contentT + this.contentB;\r
                \r
@@ -529,58 +529,61 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                         */\r
                                        if( xnode[ '_xnodes' ] && xnode[ '_xnodes' ].length ){\r
                                                if( w === X.UI.Attr.AUTO ){\r
-                                                       w = this.contentWidth = xnode[ 'css' ]( 'width', 'auto' )[ 'width' ]() / X_Node_CSS_getCharSize( xnode );\r
+                                                       w = this.contentWidth = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'width', 'auto' )[ 'width' ]() / X_Node_CSS_getCharSize( xnode ) );\r
+                                                       console.log( 'chr ' + X_Node_CSS_getCharSize( xnode ) );\r
                                                        \r
-                                                       this.scrollWidth = w + this.contentL + this.contentR;\r
+                                                       //this.scrollWidth = w + this.contentL + this.contentR;\r
                                                        if( this.maxContentWidth < w - this.boxSizingOffsetLR ) this.contentWidth = this.maxContentWidth + this.boxSizingOffsetLR;\r
                                                        if( w - this.boxSizingOffsetLR < this.minContentWidth ) this.contentWidth = this.minContentWidth + this.boxSizingOffsetLR;\r
                                                        this.lastContentWidth = this.contentWidth;\r
                                                        \r
-                                                       w !== this.contentWidth && xnode[ 'css' ]( 'width', XUI_AbstractUINode_ceil( this.contentWidth ) + 'em' );\r
+                                                       w !== this.contentWidth && xnode[ 'css' ]( 'width', this.contentWidth + 'em' );\r
                                                        \r
                                                        if( h === X.UI.Attr.AUTO ){\r
-                                                               this.contentHeight = h = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ); // scrollHeight() ??\r
-                                                               this.scrollHeight  = h + this.contentT + this.contentB;\r
+                                                               this.contentHeight = h = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) ); // scrollHeight() ??\r
+                                                               //this.scrollHeight  = h + this.contentT + this.contentB;\r
                                                                if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB;\r
                                                                if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB;\r
                                                        } else {\r
-                                                               this.scrollHeight = h + this.contentT + this.contentB;\r
+                                                               //this.scrollHeight = h + this.contentT + this.contentB;\r
                                                        };\r
                                                        \r
                                                        this.lastContentHeight = h;\r
                                                } else\r
                                                if( h === X.UI.Attr.AUTO ){\r
+                                                       console.log( 'chr ' + X_Node_CSS_getCharSize( xnode ) );\r
                                                        if( w !== this.lastContentWidth ){\r
-                                                               xnode[ 'css' ]( 'width', XUI_AbstractUINode_ceil( w ) + 'em' );\r
+                                                               xnode[ 'css' ]( 'width', w + 'em' );\r
                                                                \r
                                                                this.lastContentWidth  = w;\r
-                                                               this.contentHeight = h = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode );\r
-                                                               this.scrollWidth       = w + this.contentL + this.contentR;\r
-                                                               this.scrollHeight      = h + this.contentT + this.contentB;\r
+                                                               this.contentHeight = h = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) ); // ie8 clientHeight, ff scrollHeight & clientHeight\r
+                                                               //this.scrollWidth       = w + this.contentL + this.contentR;\r
+                                                               //this.scrollHeight      = h + this.contentT + this.contentB;\r
                                                                if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB;\r
                                                                if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB;                                                           \r
                                                        } else {\r
                                                                this.contentHeight = this.lastContentHeight = h =\r
-                                                                       this.lastContentHeight === -1 ? xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) : this.lastContentHeight;\r
-                                                               this.scrollWidth   = w + this.contentL + this.contentR;\r
-                                                               this.scrollHeight  = h + this.contentT + this.contentB;\r
+                                                                       this.lastContentHeight === -1 ? XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) ) : this.lastContentHeight;\r
+                                                               //this.scrollWidth   = w + this.contentL + this.contentR;\r
+                                                               //this.scrollHeight  = h + this.contentT + this.contentB;\r
                                                        };\r
                                                } else\r
                                                if( dirty !== X.UI.Dirty.LAYOUT ){\r
-                                                       this.contentWidth  = this.lastContentWidth  = w; //xnode[ 'width' ]();\r
-                                                       this.contentHeight = this.lastContentHeight = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode );\r
-                                                       this.scrollWidth   = this.contentWidth  + this.contentL + this.contentR;\r
-                                                       this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
+                                                       console.log( 'chr ' + X_Node_CSS_getCharSize( xnode ) );\r
+                                                       this.contentWidth  = this.lastContentWidth  = w;\r
+                                                       this.contentHeight = this.lastContentHeight = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) );\r
+                                                       //this.scrollWidth   = this.contentWidth  + this.contentL + this.contentR;\r
+                                                       //this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
                                                } else {\r
-                                                       this.scrollWidth  = w + this.contentL + this.contentR;\r
-                                                       this.scrollHeight = h + this.contentT + this.contentB;\r
+                                                       //this.scrollWidth  = w + this.contentL + this.contentR;\r
+                                                       //this.scrollHeight = h + this.contentT + this.contentB;\r
                                                };              \r
                                        } else {\r
                                                // コンテンツを持たないため基本のサイズは0\r
                                                if( w === X.UI.Attr.AUTO ) this.contentWidth  = w = 0 < this.minContentWidth  ? this.minContentWidth  : 0;\r
                                                if( h === X.UI.Attr.AUTO ) this.contentHeight = h = 0 < this.minContentHeight ? this.minContentHeight : 0;\r
-                                               this.scrollWidth  = w + this.contentL + this.contentR;\r
-                                               this.scrollHeight = h + this.contentT + this.contentB;\r
+                                               //this.scrollWidth  = w + this.contentL + this.contentR;\r
+                                               //this.scrollHeight = h + this.contentT + this.contentB;\r
                                        };\r
                                        \r
                                        delete this.dirty;\r
index cd5e4f4..81c1958 100644 (file)
@@ -171,8 +171,8 @@ function X_UI_ScrollBox_onLayoutComplete( e ){
        // scroll の停止、GPU の解除\r
        var font = this.fontSize = this._containerXNode.call( 'fontSize' );\r
        \r
-       this.maxScrollX = ( this.boxWidth  - this._containerNode.boxWidth ) * font | 0;\r
-       this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font | 0;\r
+       this.maxScrollX = ( this.boxWidth  - this._containerNode.boxWidth ) * font;\r
+       this.maxScrollY = ( this.boxHeight - this._containerNode.boxHeight ) * font;\r
 \r
        this.hasHScroll = this.scrollXEnabled && this.maxScrollX < 0;\r
        this.hasVScroll = this.scrollYEnabled && this.maxScrollY < 0;\r
@@ -234,14 +234,14 @@ function X_UI_ScrollBox_onLayoutComplete( e ){
                                        y : that.scrollY\r
                                },\r
                                {\r
-                                       x : x | 0,\r
-                                       y : y | 0\r
+                                       x : x,\r
+                                       y : y\r
                                },\r
                                opt_time, opt_easing, opt_release\r
                        );\r
                        \r
-                       that.scrollX = x | 0;\r
-                       that.scrollY = y | 0;\r
+                       that.scrollX = x;\r
+                       that.scrollY = y;\r
                        \r
                        if( that.indicators ){\r
                                for( i = that.indicators.length; i--; ){\r
@@ -300,6 +300,10 @@ function X_UI_ScrollBox_onMove( e ){
        if( !this.scrollEnabled || e.pointerType !== this.initiated ){\r
                return ret;\r
        };\r
+       \r
+       if( e.buttons !== 1 ){\r
+               return X_UI_ScrollBox_onEnd.call( this, e );\r
+       };\r
 \r
        // gpu の用意\r
        if( !this._containerXNode[ '_anime' ] ){\r
index 8017f28..73ef331 100644 (file)
@@ -1,8 +1,7 @@
 root = X.UI.PageRoot(\r
        X.UI.HBox(\r
                {\r
-                       //width       : '50%',\r
-                       height      : '50%',\r
+                       width       : '50%',\r
                        bgColor     : 0x44ffff\r
                },\r
                X.UI.Text( 'HTML4', { width : 3 } ),\r