Print statement affecting position, bug?

Copy paste this code into main and run it. Then try commenting out the print statement and run again and notice how the square changes position.

[lua]-- Create guides for clarity

local line  = display.newLine(0, 300, display.contentWidth, 300)

local line2 = display.newLine(100, 0, 100, display.contentHeight)

local group  = display.newGroup()

local group2 = display.newGroup()

group.y  = 300

group : insert(group2)

local square = display.newRect(0,0, 28, 28)

square : rotate(-90) – If commented out behaviour is different

group2 : insert(square)


– Comment this print statement out and square position is affected

print(group2.height) 


square   : setReferencePoint(display.CenterLeftReferencePoint)

square.x = 100[/lua]

The square:rotate function also changes the behaviour.

Odd.

Yeah… I sometomes have cases like adding or removing useless function (like print) repairs some issues or make app behave oddly too. Usually closing and reopening simulator helps.

I sometomes have cases like adding or removing useless function (like print) repairs some issues or make app behave oddly too.

I have noticed this too, something like

[lua]local temp = object.y + object.height [/lua]

will suddenly affect the position of object. Probably the same issue as we are seeing here. 

 Usually closing and reopening simulator helps. 

I even installed different simulator versions (newest daily and latest stable) with no difference. I haven’t tried on device though.

that is weird.

though the issue appears to be the call to setReferencePoint. if you comment that out, everything works consistently, no matter if the print or rotate is toggled.

in any event, definitely a bug.

Hi guys,

Is this only happening in the Simulator? If so, which build of Corona?

i only tried in the simulator (no device builds), using both 2013.1137 and 2013.1202.

Just tested on iOS 7 device and its the same behaviour.

Please file a bug report on this.  Very odd.  It’s got to be tied to the reference point some how since the rotation is affecting it.  But I don’t quite get why.  Makes no sense.  “print” shouldn’t affect anything here unless accessing group2.height is something triggering the reference point to change.

Odd.

Yeah… I sometomes have cases like adding or removing useless function (like print) repairs some issues or make app behave oddly too. Usually closing and reopening simulator helps.

I sometomes have cases like adding or removing useless function (like print) repairs some issues or make app behave oddly too.

I have noticed this too, something like

[lua]local temp = object.y + object.height [/lua]

will suddenly affect the position of object. Probably the same issue as we are seeing here. 

 Usually closing and reopening simulator helps. 

I even installed different simulator versions (newest daily and latest stable) with no difference. I haven’t tried on device though.

that is weird.

though the issue appears to be the call to setReferencePoint. if you comment that out, everything works consistently, no matter if the print or rotate is toggled.

in any event, definitely a bug.

Hi guys,

Is this only happening in the Simulator? If so, which build of Corona?

i only tried in the simulator (no device builds), using both 2013.1137 and 2013.1202.

Just tested on iOS 7 device and its the same behaviour.

Please file a bug report on this.  Very odd.  It’s got to be tied to the reference point some how since the rotation is affecting it.  But I don’t quite get why.  Makes no sense.  “print” shouldn’t affect anything here unless accessing group2.height is something triggering the reference point to change.