mirror of https://github.com/axmolengine/axmol.git
optimize layout
This commit is contained in:
parent
8a5084effa
commit
a0f794b7df
|
@ -129,7 +129,17 @@ void UILayout::setClippingEnabled(bool able)
|
||||||
void UILayout::onSizeChanged()
|
void UILayout::onSizeChanged()
|
||||||
{
|
{
|
||||||
DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(_size);
|
DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(_size);
|
||||||
doLayout();
|
if (strcmp(getDescription(), "Layout") == 0)
|
||||||
|
{
|
||||||
|
cocos2d::ccArray* arrayChildren = _children->data;
|
||||||
|
int length = arrayChildren->num;
|
||||||
|
for (int i=0; i<length; ++i)
|
||||||
|
{
|
||||||
|
UIWidget* child = (UIWidget*)arrayChildren->arr[i];
|
||||||
|
child->updateSizeAndPosition();
|
||||||
|
}
|
||||||
|
doLayout();
|
||||||
|
}
|
||||||
if (_backGroundImage)
|
if (_backGroundImage)
|
||||||
{
|
{
|
||||||
_backGroundImage->setPosition(cocos2d::Point(_size.width/2.0f, _size.height/2.0f));
|
_backGroundImage->setPosition(cocos2d::Point(_size.width/2.0f, _size.height/2.0f));
|
||||||
|
|
|
@ -381,7 +381,6 @@ void UIListView::refreshView()
|
||||||
remedyLayoutParameter(item);
|
remedyLayoutParameter(item);
|
||||||
}
|
}
|
||||||
updateInnerContainerSize();
|
updateInnerContainerSize();
|
||||||
doLayout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIListView::addEventListenerListView(cocos2d::Object *target, SEL_ListViewEvent selector)
|
void UIListView::addEventListenerListView(cocos2d::Object *target, SEL_ListViewEvent selector)
|
||||||
|
|
|
@ -881,6 +881,8 @@ public:
|
||||||
virtual void onEnter();
|
virtual void onEnter();
|
||||||
virtual void onExit();
|
virtual void onExit();
|
||||||
|
|
||||||
|
void updateSizeAndPosition();
|
||||||
|
|
||||||
virtual Object* getUserObject() { return _userObject; }
|
virtual Object* getUserObject() { return _userObject; }
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
|
@ -926,7 +928,6 @@ protected:
|
||||||
void cancelUpEvent();
|
void cancelUpEvent();
|
||||||
void longClickEvent();
|
void longClickEvent();
|
||||||
void updateAnchorPoint();
|
void updateAnchorPoint();
|
||||||
void updateSizeAndPosition();
|
|
||||||
void copyProperties(UIWidget* model);
|
void copyProperties(UIWidget* model);
|
||||||
virtual UIWidget* createCloneInstance();
|
virtual UIWidget* createCloneInstance();
|
||||||
virtual void copySpecialProperties(UIWidget* model);
|
virtual void copySpecialProperties(UIWidget* model);
|
||||||
|
|
Loading…
Reference in New Issue