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

docs: Offscreen Canvas fix touch pick and 2 fingers interactions #29983

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Arecsu
Copy link

@Arecsu Arecsu commented Nov 27, 2024

  • Picking doesn't work properly (sometimes at all) in touchscreens due to the lack of clientX and clientY values in the proxy event. Added those.

  • Added a event.preventDefault() in touchEventHandler() because, for some unknown reason, mouse events get fired in touchscreens when doing a simple tap. Happens only at Offscreen Canvas. Tested on Chrome for Android and Firefox for Android. Same behavior both. Might be intended per specification? This is the best fix I found to handle it.

  • 2 or more fingers don't get fully handled in OrbitControls, resulting in a black screen when trying to pinch-to-zoom, among other scenarios. It expects a pointerId with our custom Pointer Event proxy. To be specific, it gets called here:

_getSecondPointerPosition( event ) {
const pointerId = ( event.pointerId === this._pointers[ 0 ] ) ? this._pointers[ 1 ] : this._pointers[ 0 ];
return this._pointerPositions[ pointerId ];
}

Fixed that as well :)

Also, wanted to express how good it is to have a fully working example of Offscreen Canvas + OrbitControls. I've learned so much about workers and code structuring with it. Offscreen Canvas are desperately needed in a website I maintain to keep a javascript horizontal slider to move smoothly while loading and presenting a 3D object. Without this example, I don't think I would have been able to do it.

Thank you so much!

@mrdoob mrdoob added this to the r172 milestone Dec 12, 2024
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

Successfully merging this pull request may close these issues.

3 participants