-var _AbstractUINode = X.EventDispatcher.inherits(\r
- '_AbstractUINode',\r
+X.UI._AbstractUINode = X.EventDispatcher.inherits(\r
+ 'X.UI._AbstractUINode',\r
X.Class.ABSTRACT | X.Class.PRIVATE_DATA,\r
{\r
phase : 0,\r
reserveEvents : null,\r
gesture : null,\r
\r
- x : 0,\r
- y : 0,\r
- \r
- t : 0, // top\r
- l : 0, // left\r
- b : 0, // bottom\r
- r : 0, // right\r
absoluteX : 0,\r
absoluteY : 0,\r
\r
// :hover, :focus, :disabled\r
\r
initialize : function( root, rootData, parent, parentData ){\r
- var events = this.reserveEvents,\r
- l, i; \r
- \r
this.root = root;\r
this.rootData = rootData;\r
- this.hoverList = rootData.hoverList;\r
this.parent = parent;\r
this.parentData = parentData;\r
//this.xnode = X.Dom.Node.create( 'div' );\r
this.phase = 1;\r
\r
this.dispatch( { type : X.UI.Event.INIT } );\r
- \r
- // html 要素が親に追加されるまで控えていたイベントの登録\r
- if( events && ( l = events.length ) ){\r
- for( i = 0; i < l; ++i ){\r
- this.listen.apply( this, events[ i ] );\r
- };\r
- events.length = 0;\r
- delete this.reserveEvents;\r
- }; \r
},\r
\r
addToParent : function( parentElement ){\r
},\r
\r
creationComplete : function(){\r
+ var events = this.reserveEvents,\r
+ l, i;\r
+ \r
this.phase = 3;\r
this.User.dispatch( { type : X.UI.Event.CREATION_COMPLETE } );\r
+ \r
+ // html 要素が親に追加されるまで控えていたイベントの登録\r
+ if( events && ( l = events.length ) ){\r
+ for( i = 0; i < l; ++i ){\r
+ this.listen.apply( this, events[ i ] );\r
+ };\r
+ events.length = 0;\r
+ delete this.reserveEvents;\r
+ }; \r
},\r
\r
/*\r
* X.Dom.BoxModel の情報を引きながら top,left,width,height,padding,border の設定\r
*/\r
updateLayout : function( x, y ){\r
- x += this.boxX;\r
- y += this.boxY;\r
+ this.boxX = x;\r
+ this.boxY = y;\r
this.xnode\r
.css( 'left', x ? x + 'em' : 0 )\r
.css( 'top', y ? y + 'em' : 0 )\r
- .css( 'width', this.contentWidth ? _AbstractUINode.ceil( this.contentWidth ) + 'em' : 0 )\r
- .css( 'height', this.contentHeight ? _AbstractUINode.ceil( this.contentHeight ) + 'em' : 0 )\r
+ .css( 'width', this.contentWidth ? X.UI._AbstractUINode.ceil( this.contentWidth ) + 'em' : 0 )\r
+ .css( 'height', this.contentHeight ? X.UI._AbstractUINode.ceil( this.contentHeight ) + 'em' : 0 )\r
.css( 'padding', this._createCssText( 'padding' ) )\r
.css( 'borderWidth', this._createCssText( 'borderWidth' ) );\r
},\r
*/\r
preMesure : function( allowedW, allowedH ){\r
var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
- calc = _AbstractUINode.calcValue,\r
+ calc = X.UI._AbstractUINode.calcValue,\r
box = attrs[ X.UI.Attr.Support.sizing.No ],\r
min, max,\r
boxL, boxT, boxR, boxB,\r
if( this.constraintW ){ // 制約レイアウト\r
contentW = allowedW - ( boxL = calc( attrs[ X.UI.Attr.Support.left.No ], allowedW ) ) - ( boxR = calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );\r
} else {\r
- contentW = _AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ); \r
+ contentW = X.UI._AbstractUINode.finalValue( 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
if( this.constraintH ){ // 制約レイアウト\r
contentH = allowedH - ( boxT = calc( attrs[ X.UI.Attr.Support.top.No ], allowedH ) ) - ( boxB = calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );\r
} else {\r
- contentH = _AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH );\r
+ contentH = X.UI._AbstractUINode.finalValue( 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
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', _AbstractUINode.ceil( this.contentWidth ) + 'em' );\r
+ w !== this.contentWidth && xnode.css( 'width', X.UI._AbstractUINode.ceil( this.contentWidth ) + 'em' );\r
\r
if( h === X.UI.Attr.AUTO ){\r
- this.contentHeight = h = xnode.scrollHeight() / xnode._getCharSize(); // scrollHeight() ??\r
+ this.contentHeight = h = xnode.css( 'height', 'auto' ).scrollHeight() / xnode._getCharSize(); // 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
if( h === X.UI.Attr.AUTO ){\r
if( w !== this.lastContentWidth ){\r
- xnode.css( 'width', _AbstractUINode.ceil( w ) + 'em' );\r
+ xnode.css( 'width', X.UI._AbstractUINode.ceil( w ) + 'em' );\r
\r
this.lastContentWidth = w;\r
- this.contentHeight = h = xnode.scrollHeight() / xnode._getCharSize();\r
+ this.contentHeight = h = xnode.css( 'height', 'auto' ).scrollHeight() / xnode._getCharSize();\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.scrollHeight() / xnode._getCharSize() : this.lastContentHeight;\r
+ this.lastContentHeight === -1 ? xnode.css( 'height', 'auto' ).scrollHeight() / xnode._getCharSize() : 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.scrollHeight() / xnode._getCharSize();\r
+ this.contentHeight = this.lastContentHeight = xnode.css( 'height', 'auto' ).scrollHeight() / xnode._getCharSize();\r
this.scrollWidth = this.contentWidth + this.contentL + this.contentR;\r
this.scrollHeight = this.contentHeight + this.contentT + this.contentB;\r
} else {\r
*/\r
postMesure : function(){\r
var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
- calc = _AbstractUINode.calcValue,\r
+ calc = X.UI._AbstractUINode.calcValue,\r
box = attrs[ X.UI.Attr.Support.sizing.No ],\r
contentW, contentH,\r
contentPlus,\r
capcher : function( x, y ){\r
if( this.pointerDisabled ) return false;\r
\r
- x -= this.x;\r
- y -= this.y;\r
+ x -= this.boxX;\r
+ y -= this.boxY;\r
\r
if( 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight ){\r
- !this.hovering && ( this.hoverList[ this.hoverList.length ] = this );\r
+ \r
+ !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this );\r
this.rootData.targetNodeData = this;\r
return true;\r
};\r
this.gesture.listen( type );\r
};\r
} else {\r
+ console.log( type )\r
root = this.rootData;\r
counter = root.eventCounter;\r
if( counter[ type ] ){\r
++counter[ type ];\r
} else {\r
counter[ type ] = 1; \r
- root.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ type ], eventRellay );\r
+ root.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ type ], X.UI._eventRellay );\r
};\r
};\r
};\r
if( !counter[ type ] ) return this;\r
--counter[ type ];\r
if( counter[ type ] === 0 ){\r
- root.xnodeInteractiveLayer.unlisten( X.UI.Event.IdToName[ type ], eventRellay );\r
+ root.xnodeInteractiveLayer.unlisten( X.UI.Event.IdToName[ type ], X.UI._eventRellay );\r
delete counter[ type ];\r
};\r
};\r
}\r
);\r
\r
-_AbstractUINode.calcValue = function( styleValue, srcValue ){\r
+X.UI._AbstractUINode.calcValue = function( styleValue, srcValue ){\r
/*\r
* String の場合は必ず %\r
*/ \r
return styleValue;\r
};\r
\r
-_AbstractUINode.finalValue = function( styleValue, styleMin, styleMax, srcValue ){\r
- var calc = _AbstractUINode.calcValue,\r
+X.UI._AbstractUINode.finalValue = function( styleValue, styleMin, styleMax, srcValue ){\r
+ var calc = X.UI._AbstractUINode.calcValue,\r
v = calc( styleValue, srcValue ),\r
min = calc( styleMin, srcValue ),\r
max = calc( styleMax, srcValue );\r
return v <= min ? min : max <= v ? max : v;\r
};\r
-_AbstractUINode.ceil = function( v ){\r
+X.UI._AbstractUINode.ceil = function( v ){\r
if( 0 <= v ){\r
return ( v * 10 + 0.999 | 0 ) / 10;\r
};\r
return ( -v * 10 + 0.999 | 0 ) / -10;\r
};\r
\r
-var AbstractUINode = X.Class.create(\r
+X.UI.AbstractUINode = X.Class.create(\r
'AbstractUINode',\r
X.Class.ABSTRACT | X.Class.SUPER_ACCESS,\r
{\r
},\r
getX : function(){\r
// dirty の場合、rootData.calculate\r
- return X.Class._getPrivate( this ).x;\r
+ return X.Class._getPrivate( this ).boxX;\r
},\r
getY : function(){\r
// dirty の場合、rootData.calculate\r
- return X.Class._getPrivate( this ).y;\r
+ return X.Class._getPrivate( this ).boxY;\r
},\r
getAbsoluteX : function(){\r
// dirty の場合、rootData.calculate\r