I need to use preventDefault() for ui-element ‘touchstart’ event. I can’t. I get ‘Unable to preventDefault inside passive event…’ because ‘touchstart’ is always passive. Is there any way to solve this???
Can you tell me about your use case? Probably I can suggest some alternative way? Otherwise, we can set passive to false but it is also limited.
I used playcanvas ui to create a touch control for player movement. When I press a touch control, I call stopPropagation to prevent further handling of that finger by app.touch. This allows me to handle camera rotation and player movement at the same time. But! When I press my control to move the player, on mobile it calls the default action, like “tap and hold”, and I can’t prevent that!
I don’t understand why I can use preventDefault for ‘touchstart’ with app.touch, but cannot with element component.
I think this is not the only case where this could become a problem.
I’ve built several games and experiences but this never happened to me.
It would be great if you could recreate this issue in an empty project and share it here, or you can reach me in dm if you can share your project there.