Re: [uievents] Expose 'inertial scrolling state' in wheel events (#58)

On second thought, I'm not sure this is sufficient. I'm thinking through the case where the user is two-finger scrolling on a trackpad and you need to determine the moment that they lift their fingers (could be interpreted as "letting go" of something on-screen).

Out of band 'gesture-phase' events might be a more flexible solution. The idea would be that scroll events could be "bracketed" by other gesture events which you could subscribe to (or completely ignore). iOS already fires 'gesture[start/change/end]', not sure if it's smart to overload those or invent something new. 

    element.addEventListener('scrollinggesturesomething', e => ...);
    element.addEventListener('wheel', e => ...);

The event sequence for a scroll-plus-throw might look something like:

    scrolling-gesture-begin
    wheel event 1
    wheel event 2
    wheel event 3
    scrolling-gesture-end
    scrolling-inertia-begin
    wheel event 4
    wheel event 5
    wheel event 6
    scrolling-inertia-end

And the event sequence for a scroll-then-stop-then-lift (zero velocity fingers at the end of the gesture)

    scrolling-gesture-begin
    wheel event 1
    wheel event 2
    wheel event 3
    scrolling-gesture-end

(It is important to see that 'scrolling-gesture-end' so the application knows when it can update it's internal physics state).

Applications can determine the previously proposed 'isInertialScrolling' by checking if wheel events are inside the inertial bracket.


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/58#issuecomment-157711778

Received on Wednesday, 18 November 2015 13:24:39 UTC