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
|
@ -261,6 +261,11 @@ void PageView::handleReleaseLogic(Touch *touch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float PageView::getAutoScrollStopEpsilon()
|
||||||
|
{
|
||||||
|
return 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
void PageView::pageTurningEvent()
|
void PageView::pageTurningEvent()
|
||||||
{
|
{
|
||||||
this->retain();
|
this->retain();
|
||||||
|
|
|
@ -349,6 +349,7 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void pageTurningEvent();
|
void pageTurningEvent();
|
||||||
|
virtual float getAutoScrollStopEpsilon() override;
|
||||||
|
|
||||||
virtual void remedyLayoutParameter(Widget* item)override;
|
virtual void remedyLayoutParameter(Widget* item)override;
|
||||||
virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) override;
|
virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) override;
|
||||||
|
|
|
@ -502,6 +502,11 @@ bool ScrollView::isNecessaryAutoScrollBrake()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ScrollView::getAutoScrollStopEpsilon()
|
||||||
|
{
|
||||||
|
return FLT_EPSILON;
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollView::processAutoScrolling(float deltaTime)
|
void ScrollView::processAutoScrolling(float deltaTime)
|
||||||
{
|
{
|
||||||
// Make auto scroll shorter if it needs to deaccelerate.
|
// Make auto scroll shorter if it needs to deaccelerate.
|
||||||
|
@ -520,7 +525,7 @@ void ScrollView::processAutoScrolling(float deltaTime)
|
||||||
|
|
||||||
// Calculate the new position
|
// Calculate the new position
|
||||||
Vec2 newPosition = _autoScrollStartPosition + (_autoScrollTargetDelta * percentage);
|
Vec2 newPosition = _autoScrollStartPosition + (_autoScrollTargetDelta * percentage);
|
||||||
bool reachedEnd = (percentage == 1);
|
bool reachedEnd = fabs(percentage - 1) <= this->getAutoScrollStopEpsilon();
|
||||||
|
|
||||||
if(_bounceEnabled)
|
if(_bounceEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -624,6 +624,7 @@ protected:
|
||||||
void updateScrollBar(const Vec2& outOfBoundary);
|
void updateScrollBar(const Vec2& outOfBoundary);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual float getAutoScrollStopEpsilon();
|
||||||
Layout* _innerContainer;
|
Layout* _innerContainer;
|
||||||
|
|
||||||
Direction _direction;
|
Direction _direction;
|
||||||
|
|
Loading…
Reference in New Issue