OSDN Git Service

Version 0.6.58, X.UI.HBox is working.
[pettanr/clientJs.git] / 0.6.x / js / ui / 11_VBox.js
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