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

Some higher level events #14

Open
knownasilya opened this issue Sep 25, 2020 · 6 comments
Open

Some higher level events #14

knownasilya opened this issue Sep 25, 2020 · 6 comments
Labels
documentation Improvements or additions to documentation

Comments

@knownasilya
Copy link
Contributor

A panleft and panright action would be awesome.

@knownasilya
Copy link
Contributor Author

Or at least example code in the readme

@knownasilya
Copy link
Contributor Author

My use case knownasilya/ember-toggle#138

@nickschot
Copy link
Owner

Yes, some more example code would be good. What do you think a specific panleft action (for example) would look like? Usually you kind of only need the distance (over the horizontal or vertical axis) and the velocity in practical applications. Not sure what would be different in a more specific action except for the removal of most info from the POJO.

@knownasilya
Copy link
Contributor Author

Guess it doesn't add that much value, maybe just an example in the readme how to differentiate between left/right (and u/down when vertical is implemented)

@nickschot nickschot added the documentation Improvements or additions to documentation label Oct 3, 2020
@abel-n
Copy link

abel-n commented Nov 17, 2021

I stumbled upon this addon while looking for a modern solution to detect a sort of "quick swipe left/right" gesture for sidebar open state manipulation. I'm pretty noob regarding touch events, so I couldn't figure out the appropriate way to detect the swipe but not trigger on regular horizontal scroll.

I would like to mimic iPhone native app "swipe from left" behavior, not interfering with regular scroll, so the most ideal IMO would be to check (on document body / the app wrapper div):

  • a horizontal, quick swipe motion was done
  • with not much vertical delta

Can you maybe provide an example for that? 🙏

Notes:

  • As some browsers implement the swipe from left / right to go back / forward in history, I don't want to check if the swipe was started from the side of the screen, allowing the swipe to be triggered from anywhere on the screen.
  • Triggering a regular horizontal scroll together with the swipe event is not ideal UX but I can live with it.

@nickschot
Copy link
Owner

I stumbled upon this addon while looking for a modern solution to detect a sort of "quick swipe left/right" gesture for sidebar open state manipulation. I'm pretty noob regarding touch events, so I couldn't figure out the appropriate way to detect the swipe but not trigger on regular horizontal scroll.

I would like to mimic iPhone native app "swipe from left" behavior, not interfering with regular scroll, so the most ideal IMO would be to check (on document body / the app wrapper div):

  • a horizontal, quick swipe motion was done
  • with not much vertical delta

Can you maybe provide an example for that? 🙏

Notes:

  • As some browsers implement the swipe from left / right to go back / forward in history, I don't want to check if the swipe was started from the side of the screen, allowing the swipe to be triggered from anywhere on the screen.
  • Triggering a regular horizontal scroll together with the swipe event is not ideal UX but I can live with it.

If you only want to detect a quick swipe and not do anything with a (slow) drag you can use the velocity properties from the touchData object specified in the README. You'll have to play a bit to find a threshold for the velocity that works for your use case. Afaik ember-toggle also implements only a quick swipe, though they don't seem to look at velocity, just at if any distance is present.

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

No branches or pull requests

3 participants