NEW 150020
Allow access to WheelEvent phase and momentumPhase from JavaScript
https://bugs.webkit.org/show_bug.cgi?id=150020
Summary Allow access to WheelEvent phase and momentumPhase from JavaScript
Devon Govett
Reported 2015-10-11 16:16:03 PDT
Currently, it is impossible to know whether a WheelEvent is caused by direct user manipulation, or whether it is the result of momentum scrolling (deceleration). In certain circumstances it would be useful to be able to distinguish between these cases from JavaScript "wheel" event handlers, for example when implementing a custom scroll view. I noticed that WheelEvent already has phase and momentumPhase properties (at least on the Mac), with values based on the ones given by Cocoa's NSEvent [1]. I propose exposing those values to JavaScript. My guess is that some cross-platform normalization might be necessary here, but I don't know enough about other platforms to know how they work in this respect. [1] https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/occ/instp/NSEvent/momentumPhase
Attachments
Alexey Proskuryakov
Comment 1 2015-10-11 23:25:09 PDT
Could you please provide a more detailed use case? What comes to mind first are things that would make custom scroll views feel differently from system ones, and that doesn't sound like a good thing.
Devon Govett
Comment 2 2015-10-12 00:21:57 PDT
Access to this information is important to do a good job emulating system scroll views in cases where that is necessary. One example is in canvas/webgl apps that need scrolling behavior. Another is rendering long lists where only the visible elements are in the DOM (normal scroll events can cause flicker, have to do custom scrolling). If you don't know whether the user's fingers are on the trackpad or not, it is impossible to implement rubber banding/elastic scrolling correctly. For example, when you scroll above the top of the document, you can hold it there without continuing to scroll, and when you remove your fingers from the trackpad it animates back into place. Without a way to detect when the fingers are removed, it is impossible to replicate this behavior.
Radar WebKit Bug Importer
Comment 3 2015-10-12 10:53:08 PDT
Note You need to log in before you can comment on or make changes to this bug.