Disable pinch zoom on mobile

Hey everyone,

I am creating a litte pingpong game with multiple touch so that two player can play with each other on mobile device.

While playing the two touches trigger zooming in and out the screen, which strongly hinders the gameplay.

How can I prevent pinch zooming on a mobile device?

Thanks much for help, kind regards
Tristan

Some combination of the following should work, at least on iOS:

	// Prevent top level gesture scrolling/zooming
	// This if iOS Safari specific
	document.addEventListener('gesturestart', function(e) {
		e.preventDefault();
		return false;
	});
function touchStarted() {
	// This prevents scrolling gestures within the browser window
	return false;
}
1 Like

On my Android device

function touchStarted() {
	// This prevents scrolling gestures within the browser window
	return false;
}

already worked! I will see how it can work on IOS, actually Im still struggling to get any touching interaction on IOS devices, maybe you know something on that too.

Thanks much!