You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using the scroll callback, I've been wondering if the returned direction parameter should output the direction of the user's scroll input instead of the global instance direction.
Current behavior
importLenisfrom'@studio-freight/lenis'constlenis=newLenis({direction: 'vertical',smooth: true,})lenis.on('scroll',({ direction })=>{console.log({direction});// In that case, it'll always return `vertical` (lenis.direction)})
Suggested behavior
importLenisfrom'@studio-freight/lenis'constlenis=newLenis({direction: 'vertical',smooth: true,})lenis.on('scroll',({ direction })=>{console.log({direction});// returns `1` or `-1`. Based on user scroll event})
Would return 1 or -1 depending if the user is scrolling up and down (vertical) or left and right (horizontal).
I think this solution would make more sense since all other properties of that event are related to a scroll action, not the global instance.
Workaround
I've found a workaround to reproduce the suggested behavior. But I would like to know your thoughts on having this behavior built-in the library!
hey! I've made a PR to add this functionality already, we're discussing if direction is semantic enough. would love to know your thoughts too. will land soon!
Hi!
After using the scroll callback, I've been wondering if the returned
direction
parameter should output the direction of the user's scroll input instead of the global instance direction.Current behavior
Suggested behavior
Would return
1
or-1
depending if the user is scrolling up and down (vertical) or left and right (horizontal).I think this solution would make more sense since all other properties of that event are related to a scroll action, not the global instance.
Workaround
I've found a workaround to reproduce the suggested behavior. But I would like to know your thoughts on having this behavior built-in the library!
The text was updated successfully, but these errors were encountered: