is setReferencePoint correct?

Hello!

I guess I have a problem understanding the way reference points work. Consider the following code (partially taken from the “clock” example:

[code]local clock = display.newGroup()

local background = display.newImage( “purple.png” )
clock:insert( background, true )
background.x = 160; background.y = 240

local b = clock.stageBounds;
print(b.xMin…"…"…b.xMax…", “…b.yMin…”…"…b.yMax);
print(clock.xReference…","…clock.yReference)

– Set the rotation point to the center of the screen
clock:setReferencePoint( display.CenterReferencePoint )

b = clock.stageBounds;
print(b.xMin…"…"…b.xMax…", “…b.yMin…”…"…b.yMax);
print(clock.xReference…","…clock.yReference)[/code]

The loaded image (“purple.png”) is 480x480 pixels wide - the group should thus be of the same size. As a consequence, the stage bounds initally range from -80,0 to 400,480 and the reference point is at 0,0 (x,y are 0,0 as well)

After setting the reference point to the center of the group (or image), the stage bounds remain the same, but x,y and the reference point move to 160,240

Is that correct? I would have either expected that the stagebounds initially range from 0,0 to 480,480 (initially) or the reference point moves to 240,240 (at the end)

Can anybody explain this, please?

[import]uid: 4331 topic_id: 973 reply_id: 300973[/import]

Sorry to take so long to answer this, it got lost in the shuffle.

The x,y values when an object is created specifies the TopLeft corner of the object. After the object has been created, the reference point is now the center of the object and the x,y values will return that point.

You can move the reference point back to the TopLeft with:
object:setReferencePoint( display.TopLeftReferencePoint )

If you read the x,y reference points, they will be relative to the x,yOrigin points (center of the object). When the reference point is Center, the reference point is 0,0. When the reference point is TopLeft, the reference point is -w/2,-h/2 (1/2 the object’s width and height). [import]uid: 54 topic_id: 973 reply_id: 4741[/import]