I have a RichText element that I am pushing and popping RichElementText objects in to / out of. I have two questions:
- I expect the following code to left align the text. However, it appears to make a container big enough to hold the text and centers the text in said container.
lines[0].setAnchorPoint(cc.p(0,1));
lines[0].x = 710;
lines[0].y = 1600-346;
lines[0].setTextHorizontalAlignment(cc.TEXT_ALIGNMENT_LEFT);
If I change cc.TEXT_ALIGNMENT_LEFT to cc.TEXT_ALIGNMENT_CENTER the object left aligns the way I expect it to. Why!?
- So my RichText is displaying the way I want it to… however when I start pushing and popping RichElementText objects onto the RichText the changes don’t appear in the scene. So I think to myself no problem I will just update the draw. Turns out visit() is a better option. I use visit() and the text changes become visible and force the alignment back to centered. Why does the alignment change and how can I keep it from happening?
EDIT: I’m not entirely certain why, but when I used the following code the text was perfectly left aligned to the anchor point…
textLines[i].setAnchorPoint(cc.p(0.25,0.75));
textLines[i].setTextHorizontalAlignment(cc.TEXT_ALIGNMENT_LEFT);
This RichText system is strange… I am still hoping that someone will explain why this happens.