mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14907 from neokim/feature/scroll_view_touch_total_time_threshold
Add a setter for touch total time threshold in ScrollView
This commit is contained in:
commit
061c6c7c6f
|
@ -59,6 +59,7 @@ _rightBoundary(0.0f),
|
|||
_bePressed(false),
|
||||
_childFocusCancelOffsetInInch(MOVE_INCH),
|
||||
_touchMovePreviousTimestamp(0),
|
||||
_touchTotalTimeThreshold(0.5f),
|
||||
_autoScrolling(false),
|
||||
_autoScrollAttenuate(true),
|
||||
_autoScrollTotalTime(0),
|
||||
|
@ -328,7 +329,7 @@ Vec2 ScrollView::calculateTouchMoveVelocity() const
|
|||
{
|
||||
totalTime += timeDelta;
|
||||
}
|
||||
if(totalTime == 0 || totalTime >= 0.5f)
|
||||
if(totalTime == 0 || totalTime >= _touchTotalTimeThreshold)
|
||||
{
|
||||
return Vec2::ZERO;
|
||||
}
|
||||
|
@ -1304,6 +1305,16 @@ float ScrollView::getScrollBarAutoHideTime() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ScrollView::setTouchTotalTimeThreshold(float touchTotalTimeThreshold)
|
||||
{
|
||||
_touchTotalTimeThreshold = touchTotalTimeThreshold;
|
||||
}
|
||||
|
||||
float ScrollView::getTouchTotalTimeThreshold() const
|
||||
{
|
||||
return _touchTotalTimeThreshold;
|
||||
}
|
||||
|
||||
Layout* ScrollView::getInnerContainer()const
|
||||
{
|
||||
return _innerContainer;
|
||||
|
|
|
@ -505,6 +505,20 @@ public:
|
|||
*/
|
||||
float getScrollBarAutoHideTime() const;
|
||||
|
||||
/**
|
||||
* @brief Set the touch total time threshold
|
||||
*
|
||||
* @param the touch total time threshold
|
||||
*/
|
||||
void setTouchTotalTimeThreshold(float touchTotalTimeThreshold);
|
||||
|
||||
/**
|
||||
* @brief Get the touch total time threshold
|
||||
*
|
||||
* @return the touch total time threshold
|
||||
*/
|
||||
float getTouchTotalTimeThreshold() const;
|
||||
|
||||
/**
|
||||
* Set layout type for scrollview.
|
||||
*
|
||||
|
@ -620,6 +634,7 @@ protected:
|
|||
std::list<Vec2> _touchMoveDisplacements;
|
||||
std::list<float> _touchMoveTimeDeltas;
|
||||
long long _touchMovePreviousTimestamp;
|
||||
float _touchTotalTimeThreshold;
|
||||
|
||||
bool _autoScrolling;
|
||||
bool _autoScrollAttenuate;
|
||||
|
|
Loading…
Reference in New Issue