Improper width for groups that have empty groups as children

For a menu I’m creating in my game, I needed to make an empty group with a proper offset to place objects in it later. It’s parent group’s width is corrupted after this, however. I wrote a test to demonstrate this (copy to a main.lua file and launch):
local function createItem(offset)
local itemGroup = display.newGroup();
local item = display.newImage(“cube1.png”);
local emptyGroup = display.newGroup();

emptyGroup.x, emptyGroup.y = 0, -offset;

itemGroup:insert(item);
itemGroup:insert(emptyGroup);

– Despite all the contents of the group having a small width, the group has a very large width:
–print(itemGroup.width, item.width, emptyGroup.width);

return itemGroup;
end

local menuItems = display.newGroup();
local itemGroup = createItem(31);
menuItems:insert(itemGroup);
menuItems.x, menuItems.y = display.contentWidth/2, display.contentHeight/2;
local widthOutput = display.newText("Width of group with cube: "…menuItems.width, 0, display.contentHeight/4, “helvetica”, 15);
widthOutput:setTextColor(0,255,0);
print(“Cube’s root group dimensions:”, menuItems.width, menuItems.height);
[import]uid: 8145 topic_id: 2157 reply_id: 302157[/import]

Er, sorry - I referenced the cube1.png from corona’s examples, and realized that the example would be OK with

local item = display.newRect(0,0,50,50);

instead, only after posting. [import]uid: 8145 topic_id: 2157 reply_id: 6452[/import]

Thanks for posting your code. We tried to fix this problem in the last release (Corona SDK) but I re-opened the case because it was still there in a different form. Your sample shows that case and I’ll add it to our test code. This is bug #260 (which is now re-opened).

The problem occurs when you change the x or y value of an empty group.

Thanks,
-Tom [import]uid: 7559 topic_id: 2157 reply_id: 6565[/import]