Fails
Map that zooms only with a pinch
Live preview
// Two fingers are the only way to zoom this store map.const map = document.getElementById('store-map');let zoom = 1;let lastGap = 0;const gap = (t) => Math.hypot(t[0].clientX - t[1].clientX, t[0].clientY - t[1].clientY);map.addEventListener('touchmove', (e) => { if (e.touches.length !== 2) return; e.preventDefault(); const d = gap(e.touches); if (lastGap) zoom = Math.min(8, Math.max(1, zoom * d / lastGap)); lastGap = d; map.style.transform = 'scale(' + zoom + ')';});map.addEventListener('touchend', () => { lastGap = 0; });
A pinch is a multipoint gesture, and nothing else calls the zoom code. Someone who can use only one finger, a mouth stick or a head pointer has no way to zoom.