[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) <noreply@anthropic.com>
This commit is contained in:
Behdad EsfahbodandClaude Opus 4.6 committed 2026-03-30 10:51:03 -06:00
1 parent d2469853e8
commit 10ca3ef37f
3 files changed
+9 -3

No files matched your search

+1 -1
View File
@@ -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"
+6
View File
@@ -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,
+2 -2
View File
@@ -115,7 +115,7 @@ Shortcuts: Text editor:
<span id="help-desktop">drag: pan · scroll: zoom · click: animate · right-drag: rotate<br>
space: animate · b: dark mode · g: gamma · s: stem · d: debug · r: reset · ?: help</span>
<span id="help-mobile">drag: pan · pinch: zoom/rotate · 3-finger: 3D rotate<br>
tap: animate · double-tap+drag: zoom · long-press: reset</span>
tap: animate · dbl-tap+drag: zoom · long-press: reset</span>
</div>
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
<script>
@@ -205,7 +205,7 @@ tap: animate · double-tap+drag: zoom · long-press: reset</span>
lastTapTime = now;
longPressTimer = setTimeout(function () {
longPressTimer = null;
canvas.dispatchEvent(new KeyboardEvent('keydown', {key: 'r', bubbles: true}));
if (typeof _web_reset === 'function') _web_reset();
}, 500);
}
} else if (longPressTimer) {