patrick99e99 Posted March 14, 2020 Share Posted March 14, 2020 I am testing out my game on iOS, and I have a 8-directional virtual joystick overlayed on screen (a circle divided into 8 slices), and am using pixi's interaction manager for pointerdown/pointerup/pointermove events to handle touch events for detecting which direction is currently being touched... So as I am playing in full screen (iphone rotated in landscape mode), I am sliding my thumb around this "wheel", and Safari thinks "oh! GESTURE!!!".. and then all of a sudden, a scroll bar appears and the url bar comes into view-- totally ruining the experience of my game.. And then as I continue to try to play, iOS is like "OH GESTURE!!!" and then a notifications panel comes down and covers half of the screen.. and then I throw my hands up in the air and ask myself, did I make a terrible mistake trying to make a browser based game, because this behavior is literally ruining everything... Is there any way to "prevent default" on these events to stop this horrible and obnoxious behavior? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Exca Posted March 14, 2020 Share Posted March 14, 2020 You can get the touchmove from document and call preventdefault on that to block most of ios problems. Only thing I havent found a cure for is the swipe from left side of the screen to go to previous page. Other than overriding history with current page. Remember to set your touchlistener with passive:false, like this: document.addEventListener("touchmove", {passive:false}). As apple changed their devices to use passive true as a default option for smoother scrolling. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
patrick99e99 Posted March 15, 2020 Author Share Posted March 15, 2020 thanks for the reply.. But, if I am using pixi's interaction manager (pointerdown, pointerup, pointermove) via `renderer.plugins.interaction.on('pointermove', onPointerMove);`, then how am I supposed to handle the passive flag since I am not actually doing any document.addEventListeners ? Quote Link to comment Share on other sites More sharing options...
Exca Posted March 16, 2020 Share Posted March 16, 2020 Create a document listener outside of the interaction manager to handle the preventdefault. It doesn't need to be part of the interactionmanager. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.