d3 / d3-zoom

Pan and zoom SVG, HTML or Canvas using mouse or touch input.
https://d3js.org/d3-zoom
ISC License
501 stars 144 forks source link

Implement pointer handling #239

Open jarstelfox opened 2 years ago

jarstelfox commented 2 years ago

When using Edge on Windows 10 with a precision touchpad (PTP), Edge does not generate scroll events. This means that zooming does not work on PTP devices. It seems that Touch events are also not generated. This commit implements support for the upcoming/new Pointer API, which is supported across most modern browsers. The Pointer API provides a unified API for pointing devices, including both mice and touchpads.

After this commit, the Pointer API will be preferred to both the Touch and the mouse APIs if it is present.

We do preventDefault on the events in order to prevent clicks from being generated by them in addition to the pointer events, since they've been handled.