| 212 | } |
| 213 | |
| 214 | void ControlSwitchSprite::needsLayout() |
| 215 | { |
| 216 | _onSprite->setPosition(_onSprite->getContentSize().width / 2 + _sliderXPosition, |
| 217 | _onSprite->getContentSize().height / 2); |
| 218 | _offSprite->setPosition( |
| 219 | _onSprite->getContentSize().width + _offSprite->getContentSize().width / 2 + _sliderXPosition, |
| 220 | _offSprite->getContentSize().height / 2); |
| 221 | _thumbSprite->setPosition(_onSprite->getContentSize().width + _sliderXPosition, |
| 222 | _maskTexture->getContentSize().height / 2); |
| 223 | |
| 224 | _clipperStencil->setPosition(_maskTexture->getContentSize().width / 2, _maskTexture->getContentSize().height / 2); |
| 225 | |
| 226 | if (_onLabel) |
| 227 | { |
| 228 | _onLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 229 | _onLabel->setPosition(_onSprite->getPosition().x - _thumbSprite->getContentSize().width / 6, |
| 230 | _onSprite->getContentSize().height / 2); |
| 231 | } |
| 232 | if (_offLabel) |
| 233 | { |
| 234 | _offLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 235 | _offLabel->setPosition(_offSprite->getPosition().x + _thumbSprite->getContentSize().width / 6, |
| 236 | _offSprite->getContentSize().height / 2); |
| 237 | } |
| 238 | |
| 239 | setFlippedY(true); |
| 240 | } |
| 241 | |
| 242 | void ControlSwitchSprite::setSliderXPosition(float sliderXPosition) |
| 243 | { |
no test coverage detected