mirror of https://github.com/axmolengine/axmol.git
fix ListView innerContainer initial position error
This commit is contained in:
parent
db182b2e50
commit
65b78d4a49
|
@ -178,15 +178,17 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue