display.newRect() sizing problem in relation to strokeWidth

See attached image. It shows two rectangles drawn on top of each other with a slight overlap. Both have width = 200. The lower one does not have a set strokeWidth while the upper one has an large strokeWidth of 40 set to demonstrate this problem.

As you can see the rectangle’s edge drawn according to strokeWidth distributes half the thickness of the edge inside the rectangle and half outside. This is a problem.

If I want a rectangle of width = 200 then it should be drawn at that size no matter what the strokeWidth is. The edge thickness should take from the inside of the rectangle such that no matter what the strokeWidth setting is the rectangle is drawn at the fixed width specified at creation time using its width parameter. 

In doing precise UI design we should not have to worry about how the edge is drawn and how much that might be making an object larger. I suspect this issue might be affecting the other vector objects using the strokeWidth but I have not confirmed this yet. 

Has anyone noticed this issue before?

This is because Corona employs a Center Stroke to all its objects.

I’ve commented on this before where I’d like to be able to set the stroke alignment like in Abobe Illustrator.

In Illustrator you can set the alignment of the stroke to Inner, Outer or Center stroke.

Being able to select would of course be better but in the absence of this ability I would argue that this should be changed to Inner Stroke so that a rectangle of width = 200 always takes just that much space. With the Center Stroke approach there is no way to do precise design without going to great deal of trouble calculating the 1/2 strokeWidth impact all the time.

I totally agree, however since it’s been like this from the beginning I don’t think CoronaLabs will change the default as it would break every existing app that uses vector strokes.

However I’ve created a feature request that can be voted on here:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5220759-set-stroke-alignment-on-vector-object

Feel free to vote and comment :slight_smile:

Done! Thanks much for posting that feature suggestion. Voted & commented. 

I’m all for this but all out of votes. Need to find something to un-vote :slight_smile:

Same here…

I had to un-vote some requests so that I at least got 2 votes :slight_smile:

Same here. I un-voted some widget stuff seeing how they were getting ignored anyways but alas I should not pull my own thread off topic…  :slight_smile:

+2 votes from me.

This is because Corona employs a Center Stroke to all its objects.

I’ve commented on this before where I’d like to be able to set the stroke alignment like in Abobe Illustrator.

In Illustrator you can set the alignment of the stroke to Inner, Outer or Center stroke.

Being able to select would of course be better but in the absence of this ability I would argue that this should be changed to Inner Stroke so that a rectangle of width = 200 always takes just that much space. With the Center Stroke approach there is no way to do precise design without going to great deal of trouble calculating the 1/2 strokeWidth impact all the time.

I totally agree, however since it’s been like this from the beginning I don’t think CoronaLabs will change the default as it would break every existing app that uses vector strokes.

However I’ve created a feature request that can be voted on here:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5220759-set-stroke-alignment-on-vector-object

Feel free to vote and comment :slight_smile:

Done! Thanks much for posting that feature suggestion. Voted & commented. 

I’m all for this but all out of votes. Need to find something to un-vote :slight_smile:

Same here…

I had to un-vote some requests so that I at least got 2 votes :slight_smile:

Same here. I un-voted some widget stuff seeing how they were getting ignored anyways but alas I should not pull my own thread off topic…  :slight_smile:

+2 votes from me.