Test palm rejection for add-page button taps

Move the draw-or-navigate choice into touchIntent() so the rule the
canvas uses can be tested, and cover finger taps on the plus button:
accepted after writing and while the pen hovers, rejected while the
pen is down, for palm-sized contacts and right after pen activity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GaoZtJQZwLXkEgWs8twCia
This commit is contained in:
agent 2026-09-27 21:28:01 +00:00
parent 2760819466
commit d2c6e617bb
3 changed files with 45 additions and 3 deletions

View file

@ -16,7 +16,7 @@
import { bounds, intersects, rectBeside, type Rect } from '$lib/model/layout';
import { canInsert, freeSlots, freeSlotsOf, neighbor, type Dir, type Slot } from '$lib/model/tree';
import { A4, PAGE_PRESETS, type Stroke } from '$lib/model/types';
import { PalmRejector } from '$lib/ink/palm';
import { PalmRejector, touchIntent } from '$lib/ink/palm';
import { StrokeRecorder, hitStroke } from '$lib/ink/stroke';
import { pageCssVars } from '$lib/editor/pageStyle';
import { downloadCanvas } from './download';
@ -301,7 +301,7 @@
// pen-down, palm-sized contacts and right after pen use, but not for the 5 s pen session.
const plus = target.closest<HTMLElement>('.ghost');
if (e.pointerType === 'touch') {
const decision = palm.evaluate(e, fingerInks && !plus ? 'draw' : 'navigate');
const decision = palm.evaluate(e, touchIntent(fingerInks, !!plus));
if (!decision.accept) return; // palm: ignore entirely
touches.set(e.pointerId, p);
if (touches.size >= 2) {