Hello, I’m testing out the relative positioning in cocos studio, I have a simple layer with relative positioned items in it (see screenshot). I’m using the same setup as in the sonar tutorial about supporting multi-resolutions.
Now when I look into the json file from coco studio, the relative positioning is there. The ‘prePosition’ is what I need
But when looking at the loaded childs I can’t find this property. Is there a property I’m missing? Or missing some steps in general to enable relative positioning?
I’m using coco studio 2.2.6 and cocos2d-x js 3.9 btw. The code to load the json is
loadCocoStudioFileWithRelPos: function(file)
{
var winSize = cc.director.getVisibleSize();
var origin = cc.director.getVisibleOrigin();
var loadedFile = ccs.load(file, this.getCorrectPath());
var children = loadedFile.node.getChildren();
for (var i = 0; i < children.length; i++)
{
var child = loadedFile.node.children[i];
//which property do I need?
var relPos = child.getPosition();
relPos.x *= winSize.width + origin.x;
relPos.y *= winSize.height + origin.y;
child.setPosition(relPos);
}
return loadedFile;
},
So how can I access the relative positioning in the code?
