utils/preventPageZoom.jsjavascript
/**
 * Blocks browser page zoom app-wide - the kiosk/iPad UI is laid out for one
 * fixed Stage scale (see Stage.jsx), so a page zoom just breaks it.
 *
 * `touch-action: pan-x pan-y` on html/body (styles/index.scss) is the
 * primary guard; these listeners cover what CSS can't:
 * - iOS Safari: ignores `user-scalable=no` and isn't reliable about
 *   touch-action for pinch, but cancelling its proprietary gesture* events
 *   stops the page zoom. Pointer/touch events still fire, so the globe's own
 *   OrbitControls pinch-zoom keeps working.
 * - Desktop browsers: trackpad pinch arrives as `wheel` with ctrlKey (as
 *   does ctrl+mouse wheel). OrbitControls handles that wheel on its canvas
 *   before it bubbles up here; we only cancel the browser's default zoom.
 */
export function preventPageZoom() {
  const cancel = (e) => e.preventDefault();
  const opts = { passive: false };

  document.addEventListener("gesturestart", cancel, opts);
  document.addEventListener("gesturechange", cancel, opts);
  document.addEventListener("gestureend", cancel, opts);
  document.addEventListener(
    "wheel",
    (e) => {
      if (e.ctrlKey) e.preventDefault();
    },
    opts
  );
}