Merge pull request #13537 from neokim/fix_issue_13516

Fix issue 13516
This commit is contained in:
子龙山人 2015-08-25 10:01:03 +08:00
commit b0561749bd
3 changed files with 11 additions and 2 deletions

View File

@ -210,6 +210,8 @@ void ScrollView::setInnerContainerSize(const Size &size)
pos.y = _contentSize.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getContentSize().height; pos.y = _contentSize.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getContentSize().height;
} }
setInnerContainerPosition(pos); setInnerContainerPosition(pos);
updateScrollBar(Vec2::ZERO);
} }
const Size& ScrollView::getInnerContainerSize() const const Size& ScrollView::getInnerContainerSize() const

View File

@ -37,6 +37,7 @@ static const char* BODY_IMAGE_1_PIXEL_HEIGHT = "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAB
static const Color3B DEFAULT_COLOR(52, 65, 87); static const Color3B DEFAULT_COLOR(52, 65, 87);
static const float DEFAULT_MARGIN = 20; static const float DEFAULT_MARGIN = 20;
static const float DEFAULT_AUTO_HIDE_TIME = 0.2f; static const float DEFAULT_AUTO_HIDE_TIME = 0.2f;
static const float DEFAULT_SCROLLBAR_OPACITY = 0.4f;
static Sprite* createSpriteFromBase64(const char* base64String) static Sprite* createSpriteFromBase64(const char* base64String)
{ {
@ -65,7 +66,7 @@ _direction(direction),
_upperHalfCircle(nullptr), _upperHalfCircle(nullptr),
_lowerHalfCircle(nullptr), _lowerHalfCircle(nullptr),
_body(nullptr), _body(nullptr),
_opacity(100), _opacity(255 * DEFAULT_SCROLLBAR_OPACITY),
_marginFromBoundary(DEFAULT_MARGIN), _marginFromBoundary(DEFAULT_MARGIN),
_marginForLength(DEFAULT_MARGIN), _marginForLength(DEFAULT_MARGIN),
_touching(false), _touching(false),
@ -197,7 +198,12 @@ void ScrollViewBar::onEnter()
void ScrollViewBar::update(float deltaTime) void ScrollViewBar::update(float deltaTime)
{ {
if(!_autoHideEnabled || _autoHideRemainingTime <= 0) processAutoHide(deltaTime);
}
void ScrollViewBar::processAutoHide(float deltaTime)
{
if(!_autoHideEnabled || _autoHideRemainingTime <= 0)
{ {
return; return;
} }

View File

@ -153,6 +153,7 @@ private:
Vec2 calculatePosition(float innerContainerMeasure, float scrollViewMeasure, float innerContainerPosition, float outOfBoundaryValue, float actualLength); Vec2 calculatePosition(float innerContainerMeasure, float scrollViewMeasure, float innerContainerPosition, float outOfBoundaryValue, float actualLength);
void updateLength(float length); void updateLength(float length);
void processAutoHide(float deltaTime);
ScrollView* _parent; ScrollView* _parent;
ScrollView::Direction _direction; ScrollView::Direction _direction;