| 364 | } |
| 365 | |
| 366 | bool MediaPlayerControl::init(SpriteFrame* frame) |
| 367 | { |
| 368 | if (!Button::init("")) |
| 369 | { |
| 370 | return false; |
| 371 | } |
| 372 | |
| 373 | if (frame) |
| 374 | { |
| 375 | _overlay = Sprite::createWithSpriteFrame(frame); |
| 376 | AX_SAFE_RETAIN(_overlay); |
| 377 | auto spriteSize = _overlay->getContentSize(); |
| 378 | setContentSize(spriteSize); |
| 379 | _overlay->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 380 | _overlay->setPosition(_contentSize.width * 0.5f, _contentSize.height * 0.5f); |
| 381 | addProtectedChild(_overlay, -2, -1); |
| 382 | |
| 383 | if (!_ignoreSize && _customSize.equals(Vec2::ZERO)) |
| 384 | { |
| 385 | _customSize = _overlay->getContentSize(); |
| 386 | } |
| 387 | this->updateChildrenDisplayedRGBA(); |
| 388 | if (_unifySize) |
| 389 | { |
| 390 | if (!_scale9Enabled) |
| 391 | { |
| 392 | updateContentSizeWithTextureSize(spriteSize); |
| 393 | } |
| 394 | } |
| 395 | else |
| 396 | { |
| 397 | updateContentSizeWithTextureSize(spriteSize); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | return true; |
| 402 | } |
| 403 | |
| 404 | void MediaPlayerControl::onSizeChanged() |
| 405 | { |
no test coverage detected