| 391 | return _owner->getContentSize().width; |
| 392 | } |
| 393 | void LayoutComponent::setSizeWidth(float width) |
| 394 | { |
| 395 | Vec2 ownerSize = _owner->getContentSize(); |
| 396 | ownerSize.width = width; |
| 397 | |
| 398 | Node* parent = this->getOwnerParent(); |
| 399 | if (parent != nullptr) |
| 400 | { |
| 401 | const Vec2& parentSize = parent->getContentSize(); |
| 402 | if (parentSize.width != 0) |
| 403 | _percentWidth = ownerSize.width / parentSize.width; |
| 404 | else |
| 405 | { |
| 406 | _percentWidth = 0; |
| 407 | if (_usingPercentWidth) |
| 408 | ownerSize.width = 0; |
| 409 | } |
| 410 | _owner->setContentSize(ownerSize); |
| 411 | this->refreshHorizontalMargin(); |
| 412 | } |
| 413 | else |
| 414 | _owner->setContentSize(ownerSize); |
| 415 | } |
| 416 | |
| 417 | float LayoutComponent::getPercentWidth() const |
| 418 | { |
no test coverage detected