In my game, I successfully used setContentSize with ui:scale9sprite to scale sprites but not their children. This worked great. After upgrading to 3.14, for the life of me I can’t get any of my sprites to stretch. I’ve tried using the base Sprite class since I heard it’s merged with ui::scale9sprite. But same problem. Calling setCenterRect has no effect. Calling setStretchEnabled has no effect.
This is what I used to do:
calloutBox = ui::Scale9Sprite::createWithSpriteFrameName("email@example.com"); calloutBox->setScale9Enabled(true); calloutBox->setAnchorPoint(Point(0.5,0.5)); calloutBox->setPosition(Vec2(visibleSize.width*0.5,visibleSize.height*0.5));
Then I add a bunch of other sprites as children to the calloutBox.
Later, whenever I wanted to change the size of the calloutbox, all I had to do was:
And it would stretch firstname.lastname@example.org to match the content size, and all the children would be spaced out perfectly based on their anchor points and position, but they would not be stretched themselves.
How can I accomplish now that scale9sprite has been refactored? I can’t use setScale on calloutBox or all the children will get massive etc.