cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.25k stars 7.06k forks source link

fix: visual jump diring vertical scroll when inner container size is … #20663

Closed Smidimir closed 3 years ago

Smidimir commented 3 years ago

If size (more specifically -- height) of inner container in ScrollView was changed (from X to Y) during autoscroll then content of container visually "jumps up" (by (Y - X)).

It happens because implementation of ScrollView::processAutoScrolling set newPosition based on _autoScrollStartPosition which is set in ScrollView::startAutoScroll and which is not changing when size is updated.

I fixed this issue by adding compensation to _autoScrollStartPosition in ScrollView::setInnerContainerSize function.