Projects > cpp > Issues > Refactor #4397

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

(Widget::setContentSize() -> _contentSize) != (Widget::getContentSize() <- _size)

Refactor #4397 [Closed]
liangXiao 2014-03-16 16:41 . Updated about 2 years ago

Widget::setContentSize() -> _contentSize, but (Widget::getContentSize() == **_size**) != _contentSize

When we write a function as:

1
2
3
4
5
6
7
8
9
10
11
void someFunc(Node* parent, Node* node) {
    // Now we have to check whether it is a Widget or a Node

    Widget* wParent = dynamic_cast<Widget*>(parent);
    Widget* wNode = dynamic_cast<Widget*>(node);

    Size vSize = (wParent ? wParent->getSize() : parent->getContentSize());
    Size cSize = (wNode ? wNode->getSize() : node->getContentSize());

    // ...
}
walzer@cocos2d-x.org 2014-03-18 08:37
  • Description updated (diff)
  • Assignee set to Nutty

Well, it's a serious problem. Nutty is working on merging UIWidgets more compatible with the node system.

walzer@cocos2d-x.org 2014-10-08 02:51

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8368

Atom PDF

Status:Closed
Start date:2014-03-16
Priority:Low
Due date:
Assignee:Nutty
% Done:

0%

Category:-
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.