8000 Default zoom.touchable should use navigator.maxTouchPoints, if supported? · Issue #162 · d3/d3-zoom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Default zoom.touchable should use navigator.maxTouchPoints, if supported? #162
Closed
@lojjic

Description

@lojjic

As of Chrome 70, d3-zoom no longer works out of the box when using touch on desktop touchscreens. This is because Chrome has removed the ontouch* element properties on desktop OSes, and d3-zoom's defaultTouchable implementation relies on the presence of the ontouchstart element property as its feature detection. It therefore thinks touch events are unsupported, even though they still are.

See https://www.chromestatus.com/feature/4764225348042752 for their explanation.

We can work around this on a case-by-case basis by overriding the touchable config with our own implementation via zoom().touchable(...), but it would be nice to have a more reliable feature detection in defaultTouchable. It sounds like checking for the presence of window.TouchEvent should work ok but it would need proper cross-browser testing.

Alternative solutions might be: removing the filter altogether and just letting it attach unused touch event handlers in all cases, or adding a PointerEvents-based code path since that's apparently the recommended long-term approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0