Bug in filling newRoundedRect() (fills out of shape)

Hi guys,

I notice that the newRoundedRect() does not fill the object properly (see screen shot below, taken from an Android device). The fill goes ‘out of bounds’.

I notice it occurs when the height of the object is small (see code below)

I am using Corona 2013.2109

local bar = display.newRoundedRect( 0, 0, 150, 15, 12 ) bar.strokeWidth = 1 bar:setFillColor( 100/255, 100/255, 100/255, 250/255 ) bar:setStrokeColor( 1, 0, 0 )

Thanks

Hi @yosu,

My suggestion would be to reduce the “bevel” on this object, from 12 to perhaps 7 or 8. The entire object height is 15, so assuming the line goes 1 px outside of that, it’s 17. But then a bevel of 12 needs to work off half that (rounded down since it’s an odd number), thus 8… so it can’t bevel correctly past the total height it’s dealing with.

Just my two cents… 

Brent

Thanks brent. I didn’t know I had to ensure the bevel-corners are less than half the contentHeight.

Hi @yosu,

My suggestion would be to reduce the “bevel” on this object, from 12 to perhaps 7 or 8. The entire object height is 15, so assuming the line goes 1 px outside of that, it’s 17. But then a bevel of 12 needs to work off half that (rounded down since it’s an odd number), thus 8… so it can’t bevel correctly past the total height it’s dealing with.

Just my two cents… 

Brent

Thanks brent. I didn’t know I had to ensure the bevel-corners are less than half the contentHeight.