feedback4: a tap on the board stays on the tile under the finger — the field canvas is a click target of its own (a no-op click listener, render/app.js onTapTarget), so the browser's touch adjustment no longer moves a tap on the back row onto a bond disc: PR #149's 收起 toggle pushed the discs one button (≈ 55 px) to the right, and at 844×390 a tap on the row-12 unit opened the bond popup instead of selecting it (test/render/models.browser.test.js #4.1 touch, 0.1.4 release candidate; passes with #149's client diff reverted, fails with it); DESIGN §18.1 Touch; test/ui/playtest2.test.js; golden unchanged (client only)

This commit is contained in:
sganggs committed 2026-10-06 17:14:04 +08:00
1 parent 30e7acea42
commit be9710f31f
3 files changed
+20 -1

No files matched your search

+8
View File
@@ -1404,6 +1404,12 @@ export async function createFieldView(host, options = {}) {
// selects it and its underframe opens over the tile (clamped under the top bar on a phone), and the click pressed
// 撤退 / 出售 (user playtest #4 item 1 on a phone). Cancelling touchend drops them.
const onTouchEnd = (e) => { if (e.cancelable) e.preventDefault(); };
// The canvas is a click target too (a no-op listener). The browser's touch adjustment moves a tap onto a nearby
// element that responds to clicks (click / mousedown listeners, buttons, links; pointer listeners do not count) when the
// finger's contact area reaches one, so a tap on the back row right under the bond strip's discs (row 12 at 844×390 once
// the 收起 toggle of PR #149 moved the discs one button to the right) opened the bond popup instead of selecting the
// unit. As a click target that holds the finger's point the canvas wins: a tap on the board stays on the tile under it.
const onTapTarget = () => {};
canvas.addEventListener('pointerdown', onPointerDown);
canvas.addEventListener('pointermove', onPointerMove);
canvas.addEventListener('pointerup', onPointerUp);
@@ -1411,6 +1417,7 @@ export async function createFieldView(host, options = {}) {
canvas.addEventListener('pointerleave', onPointerLeave);
canvas.addEventListener('contextmenu', onContext);
canvas.addEventListener('touchend', onTouchEnd, { passive: false });
canvas.addEventListener('click', onTapTarget);
// ---- battle ---------------------------------------------------------------------------------------------
@@ -2006,6 +2013,7 @@ export async function createFieldView(host, options = {}) {
canvas.removeEventListener('pointerleave', onPointerLeave);
canvas.removeEventListener('contextmenu', onContext);
canvas.removeEventListener('touchend', onTouchEnd);
canvas.removeEventListener('click', onTapTarget);
app.ticker.remove(frame);
app.ticker.remove(preRender);
app.ticker.remove(postRender);