fix ListView innerContainer initial position error

This commit is contained in:
andyque 2015-08-25 15:15:18 +08:00
parent db182b2e50
commit 65b78d4a49
1 changed files with 6 additions and 4 deletions

View File

@ -178,18 +178,20 @@ void ScrollView::setInnerContainerSize(const Size &size)
// move children appropriately
{
float offsetY = originalInnerSize.height - innerSizeHeight;
Size newInnerSize = _innerContainer->getContentSize();
float offsetY = originalInnerSize.height - newInnerSize.height;
float offsetX = 0;
if (_innerContainer->getRightBoundary() <= _contentSize.width)
{
offsetX = originalInnerSize.width - innerSizeWidth;
offsetX = originalInnerSize.width - newInnerSize.width;
}
if(offsetX != 0 || offsetY != 0)
{
setInnerContainerPosition(Vec2(offsetX, offsetY));
Vec2 position = _innerContainer->getPosition() + Vec2(offsetX, offsetY);
setInnerContainerPosition(position);
}
}
// Calculate and set the position of the inner container.
Vec2 pos = _innerContainer->getPosition();