PDA

View Full Version : Error in MeasureEntityAndChildren function



Yogi
08-20-2013, 10:49 AM
Hey Seth

I noticed that MeasureEntityAndChildren function is working wrong when entities have changed alignment.
I think this function should working like in A point but now is working like in B point. Maybe I'm wrong?

http://yogas.neostrada.pl/measureEntityAndChildren.png

Seth
08-20-2013, 11:20 AM
Hey Seth

I noticed that MeasureEntityAndChildren function is working wrong when entities have changed alignment.
I think this function should working like in A point but now is working like in B point. Maybe I'm wrong?

http://yogas.neostrada.pl/measureEntityAndChildren.png

Hmm, I can see it does check alignment in that function (recursively too):


eAlignment align = eAlignment(pEnt->GetVar("alignment")->GetUINT32());
if (align != ALIGNMENT_UPPER_LEFT)
{
vPos -= GetAlignmentOffset(vSize, align);
}


I'm not sure why it's not working properly.. MeasureEntityAndChildren can take an optional "starting position", I wonder if setting that to something would fix it.. sorry not sure, could be a bug.

Yogi
08-20-2013, 01:10 PM
I think that issue is in


while (itor != pChildren->end())
{
CL_Rectf childR = MeasureEntityAndChildren(*itor, pVStartingPos, false);


you should subtract parent align value from childR


childR.translate(-GetAlignmentOffset(vSize, align));