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

Scrollbar doesn't update correctly when firing 'scrollTo' event #107

Open
riede opened this issue Oct 16, 2018 · 4 comments
Open

Scrollbar doesn't update correctly when firing 'scrollTo' event #107

riede opened this issue Oct 16, 2018 · 4 comments

Comments

@riede
Copy link

riede commented Oct 16, 2018

It seams, that the scrollbar doesn't update correctly when using the SlimScrollEvent-Emitter with the type: 'scrollTo'. The content scrolls correctly (e.g. position y = 100) but the scrollbar stays on top. As soon as the scrollbar is moved just a little bit the content jumps back to top. Now, the content is based on the position of the scrollbar. Using the 'recalculate' event doesn't change anything.

@sandorfr
Copy link

I noticed a similar kind of issue. lets says I have 50 elements of 20 pixels each. and my container is 100px.
If I ask to scroll to the third item (scrollto (y: 60)) it will work. However if I ask to scroll to the 19th (scroll to y: 380) it just does not move.

@sandorfr
Copy link

sandorfr commented Jan 20, 2019

So to make it work I had to use something like : Math.Min(contentHeight - scrollviewHeight, elementHieght)

More concrete example:

new SlimScrollEvent({
          type: 'scrollTo',
          y: Math.min(y, 24 * this.dataSource.data.length - 300),
          easing: 'inOutQuint',
          duration: 500,
        }),

@jkuri
Copy link
Owner

jkuri commented Jan 21, 2019

thanks @sandorfr for solution. can you provide pull request with a fix maybe?

@sandorfr
Copy link

thanks @sandorfr for solution. can you provide pull request with a fix maybe?

see #112

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

3 participants