Aligning graphics problem

I’m having a hard time understanding the coordinate system being used. 

In the following code I don’t get why my line is not drawn from the top of the rect to the bottom. 

Why does the magenta line get drawn from the middle of the rect down? 

I have anchorY = .5 and it is the same x1,y1, x2, y2 as the rect. 

local function draw\_arena() local arena\_rect = display.newRect(0,0,304,304) arena\_rect:setFillColor(1,0,0) arena\_rect.x = display.contentCenterX arena\_rect.y = display.contentCenterY local arena\_rect = display.newRect(1,1,302,301) arena\_rect:setFillColor(0,0,.3) arena\_rect.x = display.contentCenterX arena\_rect.y = display.contentCenterY local arena\_rect = display.newRect(2,2,297,299) arena\_rect:setFillColor(.3,.3,.3) arena\_rect.x = display.contentCenterX arena\_rect.y = display.contentCenterY local arena\_line = display.newLine(0,0,0,304) arena\_line.anchorY = .5 arena\_line:setStrokeColor(1,0,1) arena\_line.x = display.contentCenterX \* .75 arena\_line.y = display.contentCenterY end draw\_arena()

Add line

arena\_line.anchorSegments = true

Read more

Note: I think you should use different names for different rects.

ldurniat

Thank you.  

The linked forum topic is nearly identical to what I asked. I did search but I guess not well enough.  

Interesting to read the last post to it wherein the author suggests adding ‘anchorSegments’ to the gotcha in the documentation. 

That would have worked for me.  

Add line

arena\_line.anchorSegments = true

Read more

Note: I think you should use different names for different rects.

ldurniat

Thank you.  

The linked forum topic is nearly identical to what I asked. I did search but I guess not well enough.  

Interesting to read the last post to it wherein the author suggests adding ‘anchorSegments’ to the gotcha in the documentation. 

That would have worked for me.