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

Horizontal scrolling timeout implementation is kinda useless for some (maybe all) smooth scrolling enabled track pad/mouse #14

Open
notwatermango opened this issue May 9, 2022 · 1 comment

Comments

@notwatermango
Copy link
Contributor

Below code is called whenever user is scrolling an element while not at the edge of element.

setTimeout(() => {
      timeout = false;
}, 2000);

This actually leads to (kinda) nothing for smooth scrolls.

Above code will be called multiple times (around 50 times for one swipe in smooth scroll track pad) which will set timeout to false after 2s of each calls.

For example if it's called at time 0000 and it's called again at 1500, the first one will set timeout to false at 2000. If we scroll at 2001 at the edge, the navigation function will go in and users get navigated at 2001 because timeout is set to false.

In above case what we want is navigation timeout set to true until 3500. (right?)

I don't know any other fix except counting all calls, here are the illustration.

someCounter++;
setTimeout(() => {
      someCounter--;
}, 2000);

// ..

// disabling navigation
if (someCounter) // do not navigate

Above code works for me. Although it looks kinda ugly and probably not the best practice.

What do you think?

@totu
Copy link
Owner

totu commented May 23, 2022

If you can make a pull request I can merge 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