Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d3-zoom won't work #117

Closed
danielzgtg opened this issue Feb 25, 2023 · 4 comments
Closed

d3-zoom won't work #117

danielzgtg opened this issue Feb 25, 2023 · 4 comments

Comments

@danielzgtg
Copy link
Contributor

My issue there is at d3/d3-zoom#260 .

So xinput list --long shows a non-zero number of touch points. The number might be wrong, but it's not zero:

⎜   ↳ xwayland-touch:12                         id=10   [slave  pointer  (2)]
        Reporting 4 classes:
                Class originated from: 10. Type: XIButtonClass
                Buttons supported: 1
                Button labels: None
                Button state:
                Class originated from: 10. Type: XIValuatorClass
                Detail for Valuator 0:
                  Label: Abs MT Position X
                  Range: 0.000000 - 65535.000000
                  Resolution: 10000 units/m
                  Mode: absolute
                  Current value: 58900.060307
                Class originated from: 10. Type: XIValuatorClass
                Detail for Valuator 1:
                  Label: Abs MT Position Y
                  Range: 0.000000 - 65535.000000
                  Resolution: 10000 units/m
                  Mode: absolute
                  Current value: 25833.149671
                Class originated from: 10. Type: XITouchClass
                Touch mode: direct
                Max number of touches: 20

Both Firefox and Chrome in both Wayland and Xwayland show navigator.maxtouchpoints === 0. That is what d3-zoom reads to enable itself. I don't know if this needs to be fixed in d3-zoom, Firefox, kwin, or iptsd.

@StollD
Copy link
Member

StollD commented Feb 26, 2023

Based on a quick grep over the firefox sourcecode, that property doesn't seem to be implemented for linux so it defaults to 0.

A possible solution could be to check for 'ontouchstart' in window, this returns true on my surface and false on my desktop.

@StollD
Copy link
Member

StollD commented Feb 26, 2023

Ok, looked a bit deeper, it seems that ontouchstart is a legacy API and firefox will hide it for every address other than chrome://browser/content/blanktab.html.

You can manually enable it by setting dom.w3c_touch_events.legacy_apis.enabled to true, but this actually doesn't do autodetection, it just unconditionally enables the properties as far as I can tell. But it should at least solve your issue with d3-zoom, since it already checks for ontouchstart.

@danielzgtg
Copy link
Contributor Author

Thank you, setting dom.w3c_touch_events.legacy_apis.enabled = true works. It fixed the problem for me.

I'm also thinking about the other users that will use d3-zoom websites. I don't know whether they will eventually find this information here. For my own websites, I tried window.ontouchstart = null, but seems like one needs to do that for the specific element that d3-zoom uses instead.

The proper solution seems like implementing this navigator.maxtouchpoints for Firefox and Chromium.

@StollD
Copy link
Member

StollD commented Mar 1, 2023

Closing this since a workaround has been found and it is not an iptsd issue.

@StollD StollD closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants