Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo5 horizontal scroll view will mix up after pulling #37

Open
wangyongcong opened this issue Oct 20, 2024 · 1 comment
Open

Demo5 horizontal scroll view will mix up after pulling #37

wangyongcong opened this issue Oct 20, 2024 · 1 comment

Comments

@wangyongcong
Copy link

wangyongcong commented Oct 20, 2024

Demo5

  1. enter play mode
  2. pull left (or right) then release
  3. new items are loaded and the view will be a mix up.

I found that it's caused by the following commit. If I comment out the call to ScrollTo(index), it will be fine.

26627ae - fix: update the scroll position by a scrollbar

// by https://github.com/webitube
// Note: If the scroller position changed but the scroll velocity is exactly zero, the movement was done via a scrollbar. In this case, we need to ScrollTo() the indicated position directly.
// Note 2: The normalized scrollbar position is opposite from the ScrollTo() index. This is why the we take (1.0 - pos) instead of pos directly.            
if (_scroll.velocity.magnitude == 0.0f) {
    var pos = (Type == 0) ? vector.y : vector.x;
    var index = Mathf.RoundToInt(_count * (1.0f - pos));
    ScrollTo(index);
}     
bandicam.0076.mp4
@mopsicus
Copy link
Owner

Thanks, will check it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants