Bug 151093

Summary: Expose modern 'wheel' event parameters
Product: WebKit Reporter: loren.brichter
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Enhancement CC: bdakin, eoconnor, graouts, jonlee, loren.brichter, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

loren.brichter
Reported 2015-11-10 07:17:22 PST
Current 'wheel' events only expose bare-minimum information (dx, dy) that doesn't fully capture how modern scrollwheels and trackpads behave. Exposing two additional pieces of information would greatly improve the possibilities for interesting custom event handling. 1. Inertial-scroll events. For example, on the Mac, by checking if a native event's 'momentumPhase' == NSEventPhaseNone, one can easily filter out synthesized inertial scroll events and only capture "real" events. It is important to distinguish them if you need to do custom scroll handling (with different physics parameters or boundary cases, where naive system-provided damping will not suffice). Developers have come up with horrible hacks to work around not having this information (see https://libraries.io/npm/lethargy and weep). 2. Direction-inversion. For example, on the Mac, by checking a native event's 'directionInvertedFromDevice' one can determine if scrolling deltas reflect the actual direction the user's fingers are moving on a trackpad. This is important to implement correct-feeling custom gesture handling (e.g. for non-2D-scrolling interactions). If I may humbly propose exposing a few additional properties on delivered DOM events: .[blink|webkit]ScrollingMomentumPhase : Possible values match those described by [1]. Developers can then easily filter out synthesized momentum events by ignoring all but 'PhaseNone' type events. .[blink|webkit]ScrollingInverted : boolean reflecting the value described by [2]. Thanks for taking this into consideration. [1] https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/occ/instp/NSEvent/momentumPhase [2] https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/occ/instp/NSEvent/directionInvertedFromDevice
Attachments
Radar WebKit Bug Importer
Comment 2 2015-11-10 08:22:46 PST
Note You need to log in before you can comment on or make changes to this bug.