X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2Fui%2F08_Box.js;h=cdd5433ff2718dce73595d400e1a339a4de53279;hb=46d3fdf2559c59963e53ff6136c3fd58cd8f7a6d;hp=3ccf225837e89435c7e2a48699490dc60e5229d2;hpb=674534de31c071bb05799c874ece43a07a7883eb;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/ui/08_Box.js b/0.6.x/js/ui/08_Box.js index 3ccf225..cdd5433 100644 --- a/0.6.x/js/ui/08_Box.js +++ b/0.6.x/js/ui/08_Box.js @@ -42,7 +42,7 @@ X.UI.Layout.Canvas = X.UI.Layout.create( { }; data.postMesure(); - data.updateLayout( x, y ); + data.updateLayout( x + data.boxX, y + data.boxY ); } }); @@ -59,6 +59,9 @@ var _Box = _AbstractUINode.inherits( pointerChildren : true, through : false, + scrollingX : 0, + scrollingY : 0, + Constructor : function( layout, args ){ var i = 0, l = args.length, @@ -150,8 +153,7 @@ var _Box = _AbstractUINode.inherits( }; }; - this.phase = 3; - this.User.dispatch( { type : X.UI.Event.CREATION_COMPLETE } ); + _AbstractUINode.prototype.creationComplete.apply( this, arguments ); }, calculate : function( isNeedsDetection, x, y, w, h ){ @@ -170,9 +172,9 @@ var _Box = _AbstractUINode.inherits( _y = y - this.scrollingY; for( ; i; ){ child = uinodes[ --i ]; - if( !child.pointerDisabled && child.boxX <= _x && _x < child.boxX + child.boxWidth && child.boxY <= _y && _y < child.boxY + child.boxHeight ){ - !child.hovering && ( child.rootData.hoverList[ child.rootData.hoverList.length ] = child ); - this.hitChildData = child.rootData.targetNodeData = child; + if( !child.pointerDisabled && child.boxX <= _x && _x < child.boxX + child.boxWidth && child.boxY <= _y && _y < child.boxY + child.boxHeight && child.capcher( _x, _y ) ){ + //console.log( 'hit child ' + _x + ' ' + _y + ' boxX:' + child.boxX + ' boxY:' + child.boxY ); + this.hitChildData = child; break; }; }; @@ -181,7 +183,7 @@ var _Box = _AbstractUINode.inherits( this.hitChildData && !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this ); return !!this.hitChildData; }; - hit = 0 <= x && x < this.w && 0 <= y && y < this.h; + hit = 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight; ( this.hitChildData || hit ) && !this.hovering && ( this.rootData.hoverList[ this.rootData.hoverList.length ] = this ); if( hit && this.hitChildData === null ) this.rootData.targetNodeData = this; return hit || !!this.hitChildData; @@ -213,8 +215,7 @@ var _Box = _AbstractUINode.inherits( _p2 && data.addToParent( this.xnode ); uinodes[ uinodes.length ] = data; }; - //p3 && data.phase < 3 && data.afterAddition(); - p3 && data.phase < 4 && data.creationComplete(); + p3 && data.phase < 3 && data.creationComplete(); }; 4 <= this.phase && this.rootData.reserveCalc(); },