W3C home > Mailing lists > Public > public-pointer-events@w3.org > April to June 2017

Re: [pointerevents] Add an API to get pre-coalesced points

From: Rick Byers via GitHub <sysbot+gh@w3.org>
Date: Fri, 05 May 2017 20:33:10 +0000
To: public-pointer-events@w3.org
Message-ID: <issue_comment.created-299568756-1494016389-sysbot+gh@w3.org>
[This](https://w3c.github.io/pointerevents/extension.html#dom-pointerevent-getcoalescedevents) is [now shipping](https://www.chromestatus.com/feature/5853451217010688) in Chrome 58 (stable).

@NavidZ has updated my [eventRate](https://rbyers.github.io/eventRate.html) demo to draw smaller dots representing the points that come from `getCoalescedEvents`.  Here's a screenshot from a [Samsung Chromebook Plus](http://www.samsung.com/us/computing/chromebooks/12-14/xe513c24-k01us-xe513c24-k01us/) which has a 200hz stylus that (like other touch-like input on ChromeOS) fires events only at 60hz.
![screenshot 2017-05-05 at 3 26 43 pm](https://cloud.githubusercontent.com/assets/1280419/25762993/09902a0e-31af-11e7-8833-64f8e6d4cf92.png)

You can see how you can get much smoother curves by considering the coalesced points.  If you introduce some synthetic jank by typing "20" into the "extra work" field, you can see how the main events are impacted but the coalesced points aren't.

@NavidZ has also updated my [event-timing](https://rbyers.github.io/event-timing.html) test page to show how the timing of the coalesced events lines up with the main event and the frames (though we had a [bug](https://bugs.chromium.org/p/chromium/issues/detail?id=710442) in Chrome 58, fixed in 59).  Here's some sample output from Chrome dev channel on Linux (where we have rAF aligned mouse events enabled) with a 120hz mouse.
```
frame[0]: events 0.8ms
frame[1] 14.9ms: events
frame[2] 16.7ms: events
frame[3] 17.7ms: events 0.2ms(4.5)
frame[4] 16.2ms: events 0.1ms(12.7, 4.7)
frame[5] 16.6ms: events 0.1ms(13.3, 5.3)
frame[6] 16.6ms: events 0ms(13.9, 5.9)
frame[7] 16.7ms: events 0ms(14.6, 6.6)
frame[8] 16.7ms: events 0.1ms(15.3, 7.3)
frame[9] 16.7ms: events 0.1ms(15.9, 7.9)
frame[10] 16.7ms: events 0ms(16.6, 8.6)
frame[11] 16.7ms: events 0ms(17.3, 9.3, 1.3)
frame[12] 16.7ms: events 0ms(9.9, 1.9)
frame[13] 16.7ms: events 0ms(10.6, 2.6)
frame[14] 16.7ms: events 0ms(11.3, 3.3)
frame[15] 16.7ms: events 0ms(11.9, 3.9)
frame[16] 16.7ms: events 0.1ms(12.6, 4.6)
```

The `frame[x] 16.7ms` shows that (as expected) `requestAnimationFrame` is ticking at a steady 60hz. The 'events 0ms' bit shows how each `pointermove` event is arriving just before `requestAnimationFrame` callbacks.  The relative times in parenthesis show that the `getCoalescedEvents` are coming in at a pretty steady 120hz without any alignment to vsync (there's a slow drift relative to the vsync clock).


-- 
GitHub Notification of comment by RByers
Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/22#issuecomment-299568756 using your GitHub account
Received on Friday, 5 May 2017 20:33:17 UTC

This archive was generated by hypermail 2.3.1 : Friday, 5 May 2017 20:33:17 UTC