mirror of https://github.com/axmolengine/axmol.git
Fix container view's anchor point problem.
This commit is contained in:
parent
98371e4fbb
commit
b9d294f542
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue