[SOLVED] Canvas become dark when touching

Hi,

Default, I play contents made by playcanvas, Content body become dark when touching.
If continue to repeat the touch, It looks like screen show flashing.

iPhone 7plus
iOS 10.3.3
safari
chrome

I thinked body tag is selected by touching, I tried to edit css.However, the result did not change.

How can I avoid this problem?

Call the following straight away inside your touch event handler function:

   e.preventDefault();

See here for docs on preventDefault.

Thanks, will

I try now, playcanvas show “Uncaught TypeError: event.preventDefault is not a function”

I inserted to my project like this :

Is it wrong ?

You can access the origin event by event.event, so use event.event.preventDefault(); instead.

2 Likes

Thanks @scarlex !
I can fix this issue!

1 Like