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

How to modify the canvas in 3d graph (canvas touchAction = "auto!important") #482

Open
BernardoOlisan opened this issue Dec 11, 2023 · 1 comment

Comments

@BernardoOlisan
Copy link

BernardoOlisan commented Dec 11, 2023

By default, the canvas in threejs is broken on mobile phones. I've been attempting to scroll using mobile browsers, but the issue is that the touch scroll does not respond. I came across this solution at https://discourse.threejs.org/t/scroll-mobile-ios/50237/3, which seems to address the problem. However, the challenge with react-force-graph is that I'm unsure how to modify the canvas to set canvas.style.touchAction = "auto!important".

I have already attempted this:

        graphRef.current.controls().domElement.style.touchAction = "auto"
        graphRef.current.refresh()

        const canvas = document.getElementsByClassName("scene-container")[0].children[2]
        canvas.style.touchAction = "auto!important"

However, neither of those alternatives work. By modifying the canvas style via the browser inspector, I was able to make the touch scroll work perfectly fine. But as is known, page refresh kills it.

Is there a way to modify it? @vasturiano

@BernardoOlisan
Copy link
Author

I want to be able to scroll on a mobile phone even if the graph is fixed to full screen size and still be able to grab the nodes normally.

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

1 participant