1 2 3 4 5 6 7 | local joystick = display.newGroup() joystickOuter = display.newCircle( 60 , 60 , 59 )joystickOuter:setFillColor( 45 , 66 , 72 ) joystickOuter.strokeWidth = 2 joystickOuter:setStrokeColor( 183 , 237 , 254 ) joystick:insert( joystickOuter ) joystick.joystickOuter = joystickOuter print(joystickOuter.width) |
this width should be 120px but is reported as 122. Measuring / counting pixels on screen shows there are 120 in width
Hi Tom
Please run the demo or look at the code and do the math.
Radius of 59 pixels, gives object of 118px wide.
Adding a 2px stroke adds 1 px to either side, the outer part of the stroke.
This adds up to 120 px wide. Measuring a screen capture in a paint app will show the object is 120 px wide.
Asking corona the width gives 122px, doesn't seem right to me
Matthew,
I believe the extra pixels comes from the stroke width. The documentation for object.strokeWidth property says, "Note that stroke widths are broken up to inner and outer parts."
-Tom