MikaFil commited on
Commit
464def1
Β·
verified Β·
1 Parent(s): bbe1b69

Update interface.js

Browse files
Files changed (1) hide show
  1. interface.js +32 -23
interface.js CHANGED
@@ -342,28 +342,37 @@ const currentScriptTag = document.currentScript;
342
  }
343
  });
344
 
345
- // Bloqueurs d'input camΓ©ra quand l'overlay est ouvert
346
- // (l'overlay couvre le canvas β†’ les clics/pointeurs sont dΓ©jΓ  interceptΓ©s ;
347
- // on bloque uniquement wheel/touch qui peuvent atteindre PlayCanvas en capture)
348
- const blockForCamera = (eventName, allowScrollOnBody) => {
349
- widgetContainer.addEventListener(eventName, (e) => {
350
- if (!annIsOpen) return;
351
- const inTooltip = annTooltip.contains(e.target);
352
- const lbOpen = annLightbox.classList.contains('ann-lb-open');
353
- const inLightbox = lbOpen && annLightbox.contains(e.target);
354
- if (inTooltip || inLightbox) {
355
- e.stopImmediatePropagation();
356
- // Sur ann-scroll : autoriser le scroll natif du navigateur
357
- if (allowScrollOnBody && annScroll.contains(e.target)) return;
358
- e.preventDefault();
359
- }
360
- }, { capture: true, passive: false });
361
- };
362
-
363
- blockForCamera('wheel', true);
364
- blockForCamera('touchstart', false);
365
- blockForCamera('touchmove', true);
366
- blockForCamera('touchend', false);
 
 
 
 
 
 
 
 
 
367
 
368
  // ─────────────────────────────────────────────────────────────────────────────
369
  // 14) Fullscreen
@@ -558,4 +567,4 @@ const currentScriptTag = document.currentScript;
558
  );
559
  setMenuContentMaxSize();
560
  }, 200);
561
- })();
 
342
  }
343
  });
344
 
345
+ // ── Bloqueurs d'input camΓ©ra ──────────────────────────────────────────────
346
+ // L'overlay (position:absolute; inset:0) couvre le canvas β†’ PlayCanvas ne
347
+ // reΓ§oit pas les Γ©vΓ©nements touch/mouse qui atterrissent dessus.
348
+ // On bloque seulement :
349
+ // β€’ wheel : peut remonter jusqu'Γ  PlayCanvas mΓͺme si l'overlay est au-dessus
350
+ // β€’ touchmove : empΓͺche le drag camΓ©ra sur les navigateurs qui propagent quand mΓͺme
351
+ //
352
+ // touchstart/touchend/mousedown NE SONT PAS bloquΓ©s : sur iOS, appeler
353
+ // stopImmediatePropagation() sur touchstart en phase capture supprime la
354
+ // synthèse du click → le bouton ×, la lightbox et le lien cessent de fonctionner.
355
+
356
+ widgetContainer.addEventListener('wheel', (e) => {
357
+ if (!annIsOpen) return;
358
+ if (annTooltip.contains(e.target) || annLightbox.contains(e.target)) {
359
+ e.stopImmediatePropagation();
360
+ // Autoriser le scroll molette dans ann-scroll
361
+ if (!annScroll.contains(e.target)) e.preventDefault();
362
+ }
363
+ }, { capture: true, passive: false });
364
+
365
+ widgetContainer.addEventListener('touchmove', (e) => {
366
+ if (!annIsOpen) return;
367
+ const inTooltip = annTooltip.contains(e.target);
368
+ const lbOpen = annLightbox.classList.contains('ann-lb-open');
369
+ const inLightbox = lbOpen && annLightbox.contains(e.target);
370
+ if (inTooltip || inLightbox) {
371
+ e.stopImmediatePropagation();
372
+ // Sur ann-scroll : ne pas appeler preventDefault β†’ scroll natif iOS prΓ©servΓ©
373
+ if (!annScroll.contains(e.target)) e.preventDefault();
374
+ }
375
+ }, { capture: true, passive: false });
376
 
377
  // ─────────────────────────────────────────────────────────────────────────────
378
  // 14) Fullscreen
 
567
  );
568
  setMenuContentMaxSize();
569
  }, 200);
570
+ })();