OSDN Git Service

Version 0.6.58, X.UI.HBox is working.
authoritozyun <itozyun@user.sourceforge.jp>
Thu, 17 Jul 2014 11:30:41 +0000 (20:30 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Thu, 17 Jul 2014 11:30:41 +0000 (20:30 +0900)
0.6.x/css/xui.css
0.6.x/js/dom/10_XDom.js
0.6.x/js/main.js
0.6.x/js/ui/05_XUI_Gesture.js
0.6.x/js/ui/06_AbstractUINode.js
0.6.x/js/ui/08_Box.js
0.6.x/js/ui/11_VBox.js
0.6.x/js/ui/12_HBox.js

index 2b27751..ba028ee 100644 (file)
@@ -39,7 +39,7 @@ html, body {
        white-space        : pre-wrap;      /* CSS 2.1 */\r
        white-space        : pre-line;      /* CSS 3.0 */\r
        /* white-space : -pre-wrap;     Opera 4-6 */\r
-       /* white-space : -o-pre-wrap;   Opera 7 */\r
+       white-space        : -o-pre-wrap;   /* Opera 7 */\r
        white-space        : -moz-pre-wrap; /* Mozilla */\r
        /* white-space : -hp-pre-wrap;  HP Printers */\r
        white-space        : normal\9;   /* ie系では、 float要素へ回り込みする、 white-space の効いているテキストの位置が狂う */\r
@@ -57,23 +57,23 @@ html, body {
                width    : 100%;\r
                height   : 100%; /* 100% don't work for ie6, so ie6 need to set height as 'XXpx' by js */\r
                \r
-               user-select                 : none;\r
-               -moz-user-select            : none;\r
-               -khtml-user-select          : none;\r
+                       user-select         : none;\r
+                  -moz-user-select         : none;\r
+                -khtml-user-select         : none;\r
                -webkit-user-select         : none;\r
 \r
                /* this makes the element blocking in IE10 >, you could experiment with the value\r
                   see for more options this issue; https://github.com/EightMedia/hammer.js/issues/241 */\r
-               touch-action                : none;\r
+                   touch-action            : none;\r
                -ms-touch-action            : none;\r
-               touch-callout               : none;\r
+                       touch-callout       : none;\r
                -webkit-touch-callout       : none;\r
-               content-zooming             : none;\r
+                   content-zooming         : none;\r
                -ms-content-zooming         : none;\r
-               user-drag                   : none;\r
-               -khtml-user-drag            : none;\r
+                       user-drag           : none;\r
+                -khtml-user-drag           : none;\r
                -webkit-user-drag           : none;\r
-               tap-highlight-color         : rgba(0,0,0,0);\r
+                       tap-highlight-color : rgba(0,0,0,0);\r
                -webkit-tap-highlight-color : rgba(0,0,0,0);\r
        }\r
        .ActiveX-enabled .mouse-operation-catcher {\r
index a16dd3d..d4cee5d 100644 (file)
@@ -268,7 +268,7 @@ if( !X.UA.IE || 9 <= X.UA.IE ){
  * http://d.hatena.ne.jp/t-uchima/20051003/p1\r
  * MacIEにはattachEventが一応あるけどwindow.attachEventとdocument.attachEventしかなく他の要素にはattachEventはない。\r
  */\r
-if( X.UA.MacIE || X.UA.NetFront ){\r
+if( X.UA.MacIE || X.UA.NetFront < 4 ){\r
        X.Dom.DOM_W3C    = true;\r
        X.Dom.EVENT_DOM0 = true;\r
 } else\r
index 514de83..ab5a5b7 100644 (file)
@@ -1,22 +1,35 @@
 root = X.UI.PageRoot(\r
+       X.UI.HBox(\r
+               {\r
+                       //width       : '50%',\r
+                       height      : '50%',\r
+                       bgColor     : 0x44ffff\r
+               },\r
+               X.UI.Text( 'HTML4', { width : 3 } ),\r
+               X.UI.Text( 'Ruby on Rails' ),\r
+               X.UI.Text( 'js' ),\r
+               X.UI.Text( 'SVG' ),\r
+               X.UI.Text( 'heroku' ),\r
+               X.UI.Text( 'flash' )\r
+       ),\r
        X.UI.Box({\r
-               width   : '10%',\r
-               height  : '10%',\r
-               left    : 5,\r
-               top     : 1,\r
+               width   : '25%',\r
+               height  : '25%',\r
+               left    : '25%',\r
+               top     : '50%',\r
                bgColor : 0x0000ff\r
        }),\r
        X.UI.Box({\r
-               width       : 5,\r
-               height      : 5,\r
-               left        : '10%',\r
-               bottom      : '70%',\r
-               bgColor     : 0xff0000\r
+               width   : '25%',\r
+               height  : '25%',\r
+               left    : 0,\r
+               bottom  : 0,\r
+               bgColor : 0xff0000\r
        }),\r
        X.UI.VBox(\r
                {\r
-                       width       : '50%',\r
-                       left        : '49%',\r
+                       width       : '40%',\r
+                       left        : '55%',\r
                        top         : 5,\r
                        bottom      : 5,\r
                        bgColor     : 0x666666,\r
@@ -24,7 +37,8 @@ root = X.UI.PageRoot(
                        borderWidth : [ 0, 0, 0, 0 ],\r
                        borderStyle : 'solid dotted',\r
                        padding     : [ 4, 1 ],\r
-                       sizing      : 'border'\r
+                       sizing      : 'border',\r
+                       gapY        : 1\r
                },\r
                X.UI.Box({\r
                        width       : '50%',\r
@@ -32,10 +46,23 @@ root = X.UI.PageRoot(
                        left        : '25%',\r
                        bgColor     : 0x999999\r
                }),\r
-               X.UI.Text( 'Hello, world!', { width : '100%' } ),\r
-               X.UI.Text( '----------------------------', { width : '100%' } ),\r
-               text = X.UI.Text( 'PettanR-team. rrrrrrrrrr', { width : '100%' } )\r
-                       .listen( X.UI.Event.TAP, _onClick )\r
+               X.UI.Text( 'Hello, world!' ),\r
+               X.UI.Text( '----------------------------' ),\r
+               text = X.UI.Text( 'PettanR-team. rrrrrrrrrr' )\r
+                       .listen( X.UI.Event.TAP, _onClick ),\r
+               X.UI.HBox(\r
+                       {\r
+                               width       : '100%',\r
+                               gapX        : 2,\r
+                               bgColor     : 0xff77ff\r
+                       },\r
+                       X.UI.Text( 'HTML4', { width : 2 } ),\r
+                       X.UI.Text( 'Ruby on Rails', { width : 2 } ),\r
+                       X.UI.Text( 'js' ),\r
+                       X.UI.Text( 'SVG' ),\r
+                       X.UI.Text( 'heroku' ),\r
+                       X.UI.Text( 'flash' )\r
+               )\r
        )\r
 );\r
 _root = X.Class._getPrivate( root );\r
index bf89d47..5f1b300 100644 (file)
@@ -65,7 +65,7 @@
                // onmouseup, but when touchend has been fired we do nothing.\r
                // this is for touchdevices which also fire a mouseup on touchend\r
                if( type & MOUSE && touch_triggered ){\r
-                       return X.Callback.STOP_NOW | X.Callback.STOP_PROPAGATION | X.Callback.PREVENT_DEFAULT;\r
+                       return X.Callback.STOP_NOW | X.Callback.PREVENT_DEFAULT;\r
                }\r
                // mousebutton must be down or a touch event\r
                else if (\r
                        types = [ X.UI.Event._POINTER_MOVE, X.UI.Event._POINTER_UP, X.UI.Event._POINTER_CANCEL ];\r
                } else\r
                if( X.Dom.EVENT_TOUCH ){\r
-                       Hammer.EVENT_TYPES_START = [ X.UI.Event._TOUCH_START ];\r
-                       types = [ X.UI.Event._TOUCH_MOVE, X.UI.Event._MOUSE_MOVE, X.UI.Event._TOUCH_END, X.UI.Event._TOUCH_CANCEL ];\r
+                       Hammer.EVENT_TYPES_START = [ X.UI.Event._TOUCH_START, X.UI.Event._MOUSE_DOWN ];\r
+                       types = [ X.UI.Event._MOUSE_MOVE, X.UI.Event._MOUSE_UP, X.UI.Event._MOUSE_CANCEL,\r
+                               X.UI.Event._TOUCH_MOVE, X.UI.Event._TOUCH_END, X.UI.Event._TOUCH_CANCEL ];\r
                } else {\r
                        Hammer.EVENT_TYPES_START = [ X.UI.Event._MOUSE_DOWN ];\r
                        types = [ X.UI.Event._MOUSE_MOVE, X.UI.Event._MOUSE_UP, X.UI.Event._MOUSE_CANCEL ];\r
index 7ca7eb7..bc7de5e 100644 (file)
@@ -666,9 +666,9 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits(
                 * 自身の contentWidth, contentHeight を元に AUTO な width, height を確定していく\r
                 */\r
                postMesure : function(){\r
-                       var     attrs    = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
-                               calc     = X.UI._AbstractUINode.calcValue,\r
-                               box      = attrs[ X.UI.Attr.Support.sizing.No ],\r
+                       var     attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
+                               calc  = X.UI._AbstractUINode.calcValue,\r
+                               box   = attrs[ X.UI.Attr.Support.sizing.No ],\r
                                contentW, contentH,\r
                                contentPlus,\r
                                paddingT, paddingR, paddingB, paddingL,\r
index d089886..879315d 100644 (file)
@@ -24,7 +24,7 @@ X.UI.Layout.Canvas = X.UI.Layout.create( {
 \r
                data.preMesure( w, h );\r
                \r
-               if( isNeedsDetection && ( data.boxWidth === X.UI.Attr.AUTO || data.boxHeight === X.UI.Attr.AUTO ) ) return;\r
+               if( isNeedsDetection && ( data.boxWidth === X.UI.Attr.AUTO || data.boxHeight === X.UI.Attr.AUTO ) ) return false;\r
                \r
                _x = data.contentL;\r
                _y = data.contentT;\r
@@ -34,7 +34,7 @@ X.UI.Layout.Canvas = X.UI.Layout.create( {
                if( ( uinodes = data.uinodes ) && ( l = uinodes.length ) ){\r
                        for( i = 0; i < l; ++i ){\r
                                node = uinodes[ i ];\r
-                               node.calculate( false, _x, _y, _w, _h );        \r
+                               node.calculate( false, _x, _y, _w, _h );\r
                        };\r
                } else\r
                if( data.contentHeight === X.UI.Attr.AUTO ){\r
@@ -43,6 +43,8 @@ X.UI.Layout.Canvas = X.UI.Layout.create( {
                \r
                data.postMesure();\r
                data.updateLayout( x + data.boxX, y + data.boxY );\r
+               \r
+               return true;\r
        }\r
 });\r
 \r
@@ -157,8 +159,9 @@ X.UI._Box = X.UI._AbstractUINode.inherits(
                },\r
                \r
                calculate : function( isNeedsDetection, x, y, w, h ){\r
-                       this.layout.calculate( this, isNeedsDetection, x, y, w, h );                    \r
+                       var ret = this.layout.calculate( this, isNeedsDetection, x, y, w, h );                  \r
                        this.phase = 4;\r
+                       return ret;\r
                },\r
                \r
                capcher : function( x, y ){\r
index 35b574a..14febc5 100644 (file)
@@ -18,9 +18,11 @@ X.UI.Layout.Vertical = X.UI.Layout.create( {
        },\r
        \r
        calculate : function( data, isNeedsDetection, x, y, w, h ){\r
-               var attrs   = data.attrObject || data.attrClass.prototype,\r
+               var ret     = isNeedsDetection,\r
+                       attrs   = data.attrObject || data.attrClass.prototype,\r
                        uinodes = data.uinodes,\r
-                       l       = uinodes && uinodes.length,            \r
+                       l       = uinodes && uinodes.length,\r
+                       minFlag = false,\r
                        childW, childH, gapY,\r
                        i, _x, _y, _w, node,\r
             contentW, contentH, autoW, autoH, detectionPhase;\r
@@ -38,6 +40,8 @@ X.UI.Layout.Vertical = X.UI.Layout.create( {
                _x             = data.contentL;\r
                _y             = data.contentT;\r
 \r
+               if( !detectionPhase ) ret = false;\r
+\r
                if( l ){\r
                        _w = 0;\r
                        for( i = 0; i < l; ++i ){\r
@@ -46,10 +50,15 @@ X.UI.Layout.Vertical = X.UI.Layout.create( {
                                _y += node.boxHeight + gapY;\r
                                // 概算のみ\r
                                if( autoW ){\r
-                                       w = node.boxWidth !== X.UI.Attr.AUTO ?\r
-                                                       node.boxWidth :\r
-                                               node.minBoxWidth !== X.UI.Attr.AUTO ?\r
-                                                       node.minBoxWidth : 0;\r
+                                       if( node.boxWidth !== X.UI.Attr.AUTO ){\r
+                                               w = node.boxWidth;\r
+                                       } else\r
+                                       if( node.minBoxWidth !== X.UI.Attr.AUTO ){\r
+                                               w = node.minBoxWidth;\r
+                                               minFlag = true;\r
+                                       } else {\r
+                                               w = 0;\r
+                                       };\r
                                        if( _w < w ) _w = w;                            \r
                                };      \r
                        };\r
@@ -61,12 +70,18 @@ X.UI.Layout.Vertical = X.UI.Layout.create( {
                if( detectionPhase ){\r
                        if( autoW ) data.contentWidth  = _w;\r
                        if( autoH ) data.contentHeight = _y;\r
+                       _y = data.contentT;\r
+                       for( i = 0; i < l; ++i ){\r
+                               node = uinodes[ i ];\r
+                               node.calculate( false, _x, _y, data.contentWidth, data.contentHeight );\r
+                               _y += node.boxHeight + gapY;\r
+                       };\r
                        data.postMesure();\r
-               } else {\r
-                       //data.postMesure();\r
                };\r
                \r
                !isNeedsDetection && data.updateLayout( x + data.boxX, y + data.boxY );\r
+               \r
+               return !ret;\r
        }\r
 });\r
 \r
index b57507a..0fea3ea 100644 (file)
@@ -17,12 +17,13 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( {
        },\r
        \r
        calculate : function( data, isNeedsDetection, x, y, w, h ){\r
-               var attrs   = data.attrObject || data.attrClass.prototype,\r
+               var ret     = isNeedsDetection,\r
+                       attrs   = data.attrObject || data.attrClass.prototype,\r
                        uinodes = data.uinodes,\r
-                       l       = uinodes && uinodes.length,            \r
-                       childW, childH, gapX,\r
-                       i, _x, _y, _h, node,\r
-            contentW, contentH, autoW, autoH, detectionPhase;\r
+                       l       = uinodes && uinodes.length,\r
+                       i,\r
+            contentW, contentH, autoW, autoH, detectionPhase, gapX,            \r
+                       childW, childH, _x, _y, _h, node, minFlag;\r
 \r
                data.preMesure( w, h );\r
                \r
@@ -31,11 +32,13 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( {
                autoW          = contentW === X.UI.Attr.AUTO;\r
                autoH          = contentH === X.UI.Attr.AUTO;\r
                detectionPhase = autoW || autoH;\r
-               _x             = data.contentL;\r
-               _y             = data.contentT;\r
+               gapX           = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );\r
                childW         = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );\r
                childH         = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );\r
-               gapX           = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );\r
+               _x             = data.contentL;\r
+               _y             = data.contentT;         \r
+\r
+               if( !detectionPhase ) ret = false;\r
 \r
                if( l ){\r
                        _h = 0;\r
@@ -44,10 +47,15 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( {
                                node.calculate( detectionPhase, _x, _y, childW, childH );\r
                                _x += node.boxWidth + gapX;\r
                                if( autoH ){\r
-                                       h = node.boxHeight !== X.UI.Attr.AUTO ?\r
-                                                       node.boxHeight :\r
-                                               node.minBoxHeight !== X.UI.Attr.AUTO ?\r
-                                                       node.minBoxHeight : 0;\r
+                                       if( node.boxHeight !== X.UI.Attr.AUTO ){\r
+                                               h = node.boxHeight;\r
+                                       } else\r
+                                       if( node.minBoxHeight !== X.UI.Attr.AUTO ){\r
+                                               h = node.minBoxHeight;\r
+                                               minFlag = true;\r
+                                       } else {\r
+                                               h = 0;\r
+                                       };\r
                                        if( _h < h ) _h = h;                            \r
                                };\r
                        };\r
@@ -59,12 +67,18 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( {
                if( detectionPhase ){\r
                        if( autoW ) data.contentWidth  = _x;\r
                        if( autoH ) data.contentHeight = _h;\r
+                       _x = data.contentL;\r
+                       for( i = 0; i < l; ++i ){\r
+                               node = uinodes[ i ];\r
+                               node.calculate( false, _x, _y, data.contentWidth, data.contentHeight );\r
+                               _x += node.boxWidth + gapX;\r
+                       };\r
                        data.postMesure();\r
-               } else {\r
-                       //data.postMesure();\r
                };\r
                \r
                !isNeedsDetection && data.updateLayout( x + data.boxX, y + data.boxY );\r
+               \r
+               return !ret;\r
        }\r
 });\r
 \r