Merge pull request #15018 from zilongshanren/tweakPageViewTurningEvent

tweak PageView page turning event time.
This commit is contained in:
zilongshanren 2016-02-04 17:12:49 +08:00
commit de62924e60
4 changed files with 13 additions and 1 deletions

View File

@ -260,6 +260,11 @@ void PageView::handleReleaseLogic(Touch *touch)
}
}
}
float PageView::getAutoScrollStopEpsilon()
{
return 0.001;
}
void PageView::pageTurningEvent()
{

View File

@ -349,6 +349,7 @@ CC_CONSTRUCTOR_ACCESS:
protected:
void pageTurningEvent();
virtual float getAutoScrollStopEpsilon() override;
virtual void remedyLayoutParameter(Widget* item)override;
virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) override;

View File

@ -502,6 +502,11 @@ bool ScrollView::isNecessaryAutoScrollBrake()
return false;
}
float ScrollView::getAutoScrollStopEpsilon()
{
return FLT_EPSILON;
}
void ScrollView::processAutoScrolling(float deltaTime)
{
// Make auto scroll shorter if it needs to deaccelerate.
@ -520,7 +525,7 @@ void ScrollView::processAutoScrolling(float deltaTime)
// Calculate the new position
Vec2 newPosition = _autoScrollStartPosition + (_autoScrollTargetDelta * percentage);
bool reachedEnd = (percentage == 1);
bool reachedEnd = fabs(percentage - 1) <= this->getAutoScrollStopEpsilon();
if(_bounceEnabled)
{

View File

@ -624,6 +624,7 @@ protected:
void updateScrollBar(const Vec2& outOfBoundary);
protected:
virtual float getAutoScrollStopEpsilon();
Layout* _innerContainer;
Direction _direction;