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

iPhone-like scroll-tick event #215

Closed
kluplau opened this issue Aug 10, 2015 · 2 comments
Closed

iPhone-like scroll-tick event #215

kluplau opened this issue Aug 10, 2015 · 2 comments

Comments

@kluplau
Copy link

kluplau commented Aug 10, 2015

I was wondering if it is possible to get an event each time an item is passed?
Think of the iPhone calendar scroll-list, where it fires a tick-sound each time an item is centered.

I thought that the cycle-event was what I was looking for, but I guess it's not.

@darsain
Copy link
Owner

darsain commented Aug 10, 2015

There isn't an event that does this, and I don't think I'll be adding it. Things like this are I think in a definition of feature creep :) which Sly is already very guilty of.

But! you can implement it with existing API.

Listen for move event, which fires every time a movement frame is rendered (synced with requestAnimationFrame), and inside it, check sly.rel object, which has useful properties like firstItem (first visible item in a frame), lastItem (last visible), etc.

Than just cache the index of a desired property, and fire an event when it changes.

@darsain darsain closed this as completed Aug 10, 2015
@kluplau
Copy link
Author

kluplau commented Aug 10, 2015

Okay, totally understand you...
Great, I will look into that... thanks! 👍

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