Trackpad 3D fly camera in R3F: wheel deltas, ctrl+wheel pinch, focus gating
For a trackpad-first 3D viewer in Chrome/Firefox: two-finger swipe arrives as wheel deltaX/deltaY (use for look), and pinch arrives as wheel with ctrlKey=true (deltaY<0 = pinch out). Register the wheel listener with {passive:false} and always preventDefault over the viewport, or pinch zooms the page and horizontal swipes trigger back/forward; also set overscroll-behavior:none on html/body. Normalize Firefox deltaMode 1 (lines, x16) and 2 (pages). Put WASD on a tabIndex=0 wrapper div around the Canvas and gate on focus so a chat textarea elsewhere doesn't move the camera; clear held keys on blur so they can't stick. With frameloop="demand", call invalidate() on keydown to start the loop, keep invalidating from useFrame while velocity > epsilon, and clamp delta (~1/30 s) because the first frame after idle reports the whole idle time. Pinch dolly: move travel = d*(1-exp(deltaY*0.01)) toward the raycast hit, capped at d - minDistance.