Skip to content

Commit 0ee4ea4

Browse files
committed
bitmap 3D PFP: pointerdown is show-only, never hide
Some Android browsers / webviews misreport touch as pointerType='mouse' in PointerEvents. With my previous code that fed the result straight into setLastInput, a single misclassified canvas tap would hide the touch UI on a phone with no keyboard -- the exact bug the user hit. New asymmetric rule: - pointerdown with pointerType in {'touch', 'pen'}: setLastInput('touch') - pointerdown with pointerType='mouse' (or anything else): no-op - keydown (W/A/S/D/Space/arrows): setLastInput('kbm') Keyboard input is the only signal that can hide the touch UI; pointer input can only ever bring it back. Result: a phone session that briefly gets misreported as a mouse tap still keeps the controls visible.
1 parent 491e210 commit 0ee4ea4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

frontend/src/app/components/_ordpool/digital-artifact-viewer/bitmap-viewer/bitmap-3d-renderer.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,14 @@ export class Bitmap3dRendererComponent implements AfterViewInit, OnDestroy {
498498
camera.rotation.x -= e.movementY / 500;
499499
camera.rotation.x = Math.max(-Math.PI / 2 + 0.01, Math.min(Math.PI / 2 - 0.01, camera.rotation.x));
500500
};
501-
// First-input refinement via PointerEvent.pointerType. Fires for every
502-
// pointer event regardless of source; cheaper than guessing.
501+
// Pointer-based "re-show touch UI" path. Asymmetric on purpose: we only
502+
// ever flip TOWARDS touch from here. Some Android browsers/webviews
503+
// misreport touch as pointerType='mouse', and we don't want a
504+
// misclassified tap to hide the controls a phone user needs. Keyboard
505+
// input is the only path that can hide the touch UI.
503506
const onPointerDown = (e: PointerEvent) => {
504507
if (state !== 'pfp') return;
505-
setLastInput(e.pointerType === 'touch' ? 'touch' : 'kbm');
508+
if (e.pointerType === 'touch' || e.pointerType === 'pen') setLastInput('touch');
506509
};
507510
window.addEventListener('keydown', onKeyDown);
508511
window.addEventListener('keyup', onKeyUp);

0 commit comments

Comments
 (0)