You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The touchend event seems to be cancelable on mobile phones.
So the following code will prevent the page focus back sometime.
// try to enable touch mouseif(isTouchDevice){// handle all touch events the same wayletwasTouching,hadTouchInput;ontouchstart=ontouchmove=ontouchend=(e)=>{e.button=0;// all touches are left click// check if touching and pass to mouse eventsconsttouching=e.touches.length;if(touching){hadTouchInput||zzfx(0,hadTouchInput=1);// fix mobile audio, force it to play a sound the first time// set event pos and pass it alonge.x=e.touches[0].clientX;e.y=e.touches[0].clientY;wasTouching ? onmousemove(e) : onmousedown(e);}elseif(wasTouching)onmouseup(e);// set was touchingwasTouching=touching;// prevent normal mouse events from being calledreturn!e.cancelable;// 💥 touchend return false}}
The text was updated successfully, but these errors were encountered:
Maybe should not clearInput when touch devices lose focus?
functioninputUpdate{// clear input when lost focus (prevent stuck keys)isTouchDevice||document.hasFocus()||clearInput();// update mouse world space positionmousePos=screenToWorld(mousePosScreen);// update gamepads if enabledgamepadsUpdate();}
The
touchend
event seems to be cancelable on mobile phones.So the following code will prevent the page focus back sometime.
The text was updated successfully, but these errors were encountered: