Open GoogleCodeExporter opened 9 years ago
oh, override protected function measure():void needs to change as well, to take
the widths into account, rather than the hard-coded "10". same code change as
the updateDisplayList chunk above.
Original comment by seanbcus...@gmail.com
on 24 Jun 2010 at 3:33
actually, while subclassing it i got height overrides to work, too. you can
refactor the overrides here. with this, there's a
top/bottom/right/left/width/height of the button in css that all work:
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList( unscaledWidth, unscaledHeight );
if(closeButton.visible)
{
var top:* = this.closeButton.getStyle( "top" );
var right:* = this.closeButton.getStyle( "right" );
var bottom:* = this.closeButton.getStyle( "bottom" );
var left:* = this.closeButton.getStyle( "left" );
if( top == undefined ) top = 4;
if( right == undefined ) right = 4;
if( bottom == undefined ) bottom = 0;
if( left == undefined ) left = 0;
closeButton.x = unscaledWidth - closeButton.width - uint(right) + uint(left);
closeButton.y = uint(top);
}
}
override protected function measure():void {
super.measure();
var w:* = this.closeButton.getStyle( "width" );
var h:* = this.closeButton.getStyle( "height" );
var top:* = this.closeButton.getStyle( "top" );
var right:* = this.closeButton.getStyle( "right" );
var bottom:* = this.closeButton.getStyle( "bottom" );
var left:* = this.closeButton.getStyle( "left" );
if( top == undefined ) top = 4;
if( right == undefined ) right = 4;
if( bottom == undefined ) bottom = 0;
if( left == undefined ) left = 0;
if( w == undefined ) w = 10;
if( h == undefined ) h = 10;
if( closePolicy == SuperTab.CLOSE_ALWAYS || closePolicy == SuperTab.CLOSE_ROLLOVER ) {
// the close icon is 10 px wide and 4px from the right - undo that (hack)
measuredMinWidth -= (10 /* +4 seems to have not been added, so don't subtract */ );
measuredMinWidth += (w+left+right);
measuredMinHeight = Math.max( measuredMinHeight, h+top+bottom );
measuredHeight = Math.max( measuredHeight, h+top+bottom );
}
else if( closePolicy == SuperTab.CLOSE_SELECTED && selected ) {
// undo and reapply (hack)
measuredMinWidth -= (10 /* +4 seems to have not been added, so don't subtract */ );
measuredMinWidth += (w+left+right);
measuredMinHeight = Math.max( measuredMinHeight, h+top+bottom );
measuredHeight = Math.max( measuredHeight, h+top+bottom );
}
}
Original comment by seanbcus...@gmail.com
on 24 Jun 2010 at 6:29
Original issue reported on code.google.com by
seanbcus...@gmail.com
on 24 Jun 2010 at 3:28