The previous fix stopped the 2->1 jump by swallowing the pinch-ending
touchend and seeding a synthetic left-button press at the remaining
finger. But subsequent one-finger motion was still left to the browser,
which does not reliably resume mouse emulation mid-gesture.
Track an explicit single-finger pan mode after the pinch handoff, route
its touchmove events to synthetic mousemove, and end it with a
gesture-cancelled synthetic mouseup on lift or touchcancel.
Testing:
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh
Assisted-by: OpenAI Codex
The WebGL touch path only tracked the initial 3->2 reseed with
skipNextPinchMove. Once a real pinch was underway, the later 2->1
transition stopped being treated as a gesture handoff and fell back
into the browser/GLFW single-touch path.
Track pinch-active state explicitly, swallow the pinch-ending touchend,
and hand single-finger pan off from the remaining touch by syncing the
cursor before synthesizing mousedown. This keeps the 3->2->1 sequence
from jumping the view when the second finger lifts.
Testing:
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh
Assisted-by: OpenAI Codex
Dispatch mousemove before mousedown when transitioning from
pinch to single-finger pan, so GLFW's cursor position matches
the remaining finger.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Double-left-click and double-right-click both reset view.
Middle-click reset also still works. Updated help text.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GLFW doesn't see the remaining finger after a swallowed pinch,
so synthesize a mousedown to start drag tracking.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WebGL mobile currently commits a tap on touchstart, then the second
tap in a double-tap zoom has to undo that animation toggle. This
makes tap and double-tap drag compete and can start animation before
gesture intent is clear.
Track a pending single tap until touchend, suppress the synthetic
click toggle on release, and only fire the animation toggle after the
double-tap timeout expires. A second tap now cancels that pending
toggle and claims double-tap zoom directly.
Testing:
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- source /home/behdad/emsdk/emsdk_env.sh >/dev/null &&
EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh
Assisted-by: OpenAI Codex
Track the last gesture centroid and explicitly handle touchcancel
for both web gesture paths. This clears active gesture state
without turning browser-driven cancellation into a tap, fling, or
stuck drag.
Testing:
- sh -n util/gpu/web/build.sh
- sh -n util/gpu/web/build-webgpu.sh
- EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build.sh
- EM_CACHE=/tmp/emscripten-cache ./util/gpu/web/build-webgpu.sh
(blocked offline fetching emdawnwebgpu)
Assisted-by: OpenAI Codex
Properly handle finger count transitions with cooldown and
state reinitialization to prevent jumps in zoom/rotation.
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prevents jumps during 3→2→1 finger transitions by dropping
one frame and reinitializing pinch state for the new finger
count.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reinitialize pinch state (distance, angle, centroid) when
exiting 3-finger mode with 2 fingers remaining. Prevents
large zoom/rotate delta from stale pinch values.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add demo_view_request_redraw() and export as _web_request_redraw.
Shell calls it on visibilitychange, focus, pageshow, and
webglcontextrestored events to force a redraw after phone
lock/unlock or tab switch.
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Toggle canvas width by 1px to ensure GLFW detects the size
change and triggers a redraw after phone lock/unlock.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
preventDefault on touchend after long-press fires, so GLFW
doesn't see it as a click.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Long-press uses _web_reset directly with 10px jitter threshold.
Double-tap-drag undoes first tap's animation toggle via
_web_toggle_animation, then preventDefault blocks GLFW from
seeing the second tap.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use exported _web_reset() for long-press instead of synthesized
keyboard event. Second tap of double-tap-drag naturally undoes
the first tap's animation toggle via GLFW click handling.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Long-press (500ms) resets view. Double-tap and drag vertically
zooms in/out (one-handed zoom like Google Maps).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Single demo_view_pinch() handles all three components atomically:
- Pan from centroid movement
- Zoom around centroid (proven middle-drag math)
- Screen-space Z rotation (separate from 3D quaternion)
Pinch rotation uses a screen_angle field applied as a post-MVP
2D rotation, keeping it independent from the 3D trackball.
Zoom centering works correctly; rotation centering is approximate.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds demo_view_zoom_around() which scales while compensating
translation so the midpoint between fingers stays fixed.
Same maps-like behavior as the pinch rotation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds demo_view_rotate_z_around() which compensates translation
so the point between the two fingers stays fixed during rotation,
like maps apps.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two-finger pinch now does both zoom (distance change) and Z-axis
rotation (angle change) simultaneously. Adds demo_view_rotate_z()
for direct Z-axis rotation from touch input.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Only toggle on keydown (not keyup). Remove vsync from web help.
Format key names with spaces.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Press ? or / to show full keyboard/mouse/touch reference.
Esc or ? again to dismiss.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show helpful error with link to webglreport.com when WebGL2
context creation fails (e.g. Firefox with hardware acceleration
disabled or GPU blocklisted).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Refactor library fragment shaders (GLSL, MSL, WGSL) to extract
_hb_gpu_decode_glyph and _hb_gpu_curve_counts helpers, used by
both hb_gpu_render and the debug visualization.
Debug mode (d key) shows per-pixel curve counts as a heatmap:
R = horizontal band curves, G = vertical band curves, B = text
coverage. Scale 0-8 curves maps to 0-1 intensity.
Also auto-generates demo shader headers via meson, and adds
set_debug to the renderer interface.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three-finger drag on mobile now does trackball rotation, matching
right-drag on desktop. Uses centroid of three touch points.
Release with momentum triggers spin animation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Show helpful error with browser support link when WebGPU is
unavailable (JS-level check before WASM loads)
- Suggest Linux Chrome flags for Vulkan/WebGPU
- Prevent onRuntimeInitialized from hiding the error message
- Set page title to WebGL/WebGPU variant
- Make adapter failure in C++ also show HTML error
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Default to light mode matching GL demo
- Gamma cycles between 2.2 and none (no sRGB framebuffer)
- Gamma depends on dark_mode (1/2.2 for dark, 2.2 for light)
- Add console logging for key presses
- Blur backend dropdown after selection to prevent space capture
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>