MatteoScript commited on
Commit
3b53259
·
verified ·
1 Parent(s): 16d9c49

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +23 -17
index.html CHANGED
@@ -37,6 +37,7 @@
37
  overflow-x: hidden;
38
  -webkit-font-smoothing: antialiased;
39
  cursor: default;
 
40
  }
41
 
42
  /* Typography */
@@ -549,26 +550,31 @@
549
 
550
  iframe.contentWindow.focus();
551
  }
552
- // --- FIX DOPPIO TAP ZOOM ---
553
  document.addEventListener('DOMContentLoaded', () => {
554
- const gameContainer = document.querySelector('.game-zoom-container');
 
 
 
 
 
 
 
 
555
  let lastTouchEnd = 0;
556
-
 
 
 
 
 
 
 
 
 
557
  if (gameContainer) {
558
- // 1. Previeni doppio tap veloce (zoom)
559
- gameContainer.addEventListener('touchend', function (event) {
560
- const now = (new Date()).getTime();
561
- if (now - lastTouchEnd <= 300) {
562
- event.preventDefault();
563
- }
564
- lastTouchEnd = now;
565
- }, false);
566
-
567
- // 2. Previeni pinch-to-zoom manuale
568
- gameContainer.addEventListener('touchmove', function (event) {
569
- if (event.scale && event.scale !== 1) {
570
- event.preventDefault();
571
- }
572
  }, { passive: false });
573
  }
574
  });
 
37
  overflow-x: hidden;
38
  -webkit-font-smoothing: antialiased;
39
  cursor: default;
40
+ touch-action: manipulation;
41
  }
42
 
43
  /* Typography */
 
550
 
551
  iframe.contentWindow.focus();
552
  }
 
553
  document.addEventListener('DOMContentLoaded', () => {
554
+
555
+ // 1. Previene il "Pinch to Zoom" (Pizzico con due dita) su tutto il documento
556
+ document.addEventListener('touchmove', function (event) {
557
+ if (event.touches.length > 1) {
558
+ event.preventDefault(); // Blocca se ci sono più di 1 dito
559
+ }
560
+ }, { passive: false });
561
+
562
+ // 2. Previene il doppio tap veloce (Zoom) su tutto il documento
563
  let lastTouchEnd = 0;
564
+ document.addEventListener('touchend', function (event) {
565
+ const now = (new Date()).getTime();
566
+ if (now - lastTouchEnd <= 300) {
567
+ event.preventDefault();
568
+ }
569
+ lastTouchEnd = now;
570
+ }, false);
571
+
572
+ // 3. Gestione specifica per il contenitore del gioco (Massima priorità)
573
+ const gameContainer = document.querySelector('.game-zoom-container');
574
  if (gameContainer) {
575
+ gameContainer.addEventListener('touchmove', function(e) {
576
+ // Impedisce qualsiasi movimento della pagina mentre si gioca
577
+ e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
578
  }, { passive: false });
579
  }
580
  });