From 10ca3ef37f8c26f48cbf30f2ae20b0291d33ebdc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 30 Mar 2026 10:51:03 -0600 Subject: [PATCH] [gpu] Fix long-press reset and double-tap-drag animation 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) --- util/gpu/web/build.sh | 2 +- util/gpu/web/hb-gpu-web.cc | 6 ++++++ util/gpu/web/shell.html | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/util/gpu/web/build.sh b/util/gpu/web/build.sh index 86b53f1f1..c51d2a13f 100755 --- a/util/gpu/web/build.sh +++ b/util/gpu/web/build.sh @@ -31,7 +31,7 @@ em++ \ -sUSE_WEBGL2=1 \ -sFULL_ES3=1 \ -sALLOW_MEMORY_GROWTH=1 \ - -sEXPORTED_FUNCTIONS='["_main","_web_load_font","_web_set_text","_web_get_text","_web_pinch","_malloc","_free"]' \ + -sEXPORTED_FUNCTIONS='["_main","_web_load_font","_web_set_text","_web_get_text","_web_reset","_web_pinch","_malloc","_free"]' \ -sEXPORTED_RUNTIME_METHODS='["UTF8ToString","lengthBytesUTF8","stringToUTF8"]' \ --shell-file "$SRCDIR/util/gpu/web/shell.html" \ -o "$OUTDIR/index.html" diff --git a/util/gpu/web/hb-gpu-web.cc b/util/gpu/web/hb-gpu-web.cc index 0d25355bb..0c4273940 100644 --- a/util/gpu/web/hb-gpu-web.cc +++ b/util/gpu/web/hb-gpu-web.cc @@ -120,6 +120,12 @@ web_get_text () return current_text; } +EMSCRIPTEN_KEEPALIVE void +web_reset () +{ + demo_view_reset (vu); +} + EMSCRIPTEN_KEEPALIVE void web_pinch (float pan_dx, float pan_dy, float zoom_factor, float angle_delta, diff --git a/util/gpu/web/shell.html b/util/gpu/web/shell.html index b5128ae30..7e70a20bf 100644 --- a/util/gpu/web/shell.html +++ b/util/gpu/web/shell.html @@ -115,7 +115,7 @@ Shortcuts: Text editor: drag: pan · scroll: zoom · click: animate · right-drag: rotate
space: animate · b: dark mode · g: gamma · s: stem · d: debug · r: reset · ?: help
drag: pan · pinch: zoom/rotate · 3-finger: 3D rotate
-tap: animate · double-tap+drag: zoom · long-press: reset
+tap: animate · dbl-tap+drag: zoom · long-press: reset