mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15018 from zilongshanren/tweakPageViewTurningEvent
tweak PageView page turning event time.
This commit is contained in:
commit
de62924e60
|
@ -260,6 +260,11 @@ void PageView::handleReleaseLogic(Touch *touch)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
float PageView::getAutoScrollStopEpsilon()
|
||||
{
|
||||
return 0.001;
|
||||
}
|
||||
|
||||
void PageView::pageTurningEvent()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -624,6 +624,7 @@ protected:
|
|||
void updateScrollBar(const Vec2& outOfBoundary);
|
||||
|
||||
protected:
|
||||
virtual float getAutoScrollStopEpsilon();
|
||||
Layout* _innerContainer;
|
||||
|
||||
Direction _direction;
|
||||
|
|
Loading…
Reference in New Issue