Merge pull request #10870 from daiki1003/fix/scroll_view_container

Fix container view's anchor point problem.
This commit is contained in:
minggo 2015-04-27 11:44:19 +08:00
commit 98fcd83d50
1 changed files with 10 additions and 3 deletions

View File

@ -388,13 +388,20 @@ void ScrollView::relocateContainer(bool animated)
Vec2 ScrollView::maxContainerOffset() Vec2 ScrollView::maxContainerOffset()
{ {
return Vec2(0.0f, 0.0f); Point anchorPoint = _container->isIgnoreAnchorPointForPosition()?Point::ZERO:_container->getAnchorPoint();
float contW = _container->getContentSize().width * _container->getScaleX();
float contH = _container->getContentSize().height * _container->getScaleY();
return Vec2(anchorPoint.x * contW, anchorPoint.y * contH);
} }
Vec2 ScrollView::minContainerOffset() Vec2 ScrollView::minContainerOffset()
{ {
return Vec2(_viewSize.width - _container->getContentSize().width*_container->getScaleX(), Point anchorPoint = _container->isIgnoreAnchorPointForPosition()?Point::ZERO:_container->getAnchorPoint();
_viewSize.height - _container->getContentSize().height*_container->getScaleY()); float contW = _container->getContentSize().width * _container->getScaleX();
float contH = _container->getContentSize().height * _container->getScaleY();
return Vec2(_viewSize.width - (1 - anchorPoint.x) * contW, _viewSize.height - (1 - anchorPoint.y) * contH);
} }
void ScrollView::deaccelerateScrolling(float dt) void ScrollView::deaccelerateScrolling(float dt)