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

@ -27,6 +27,15 @@ const PALM_CONTACT_PX = 35;
/** What an accepted touch would do: ink (draw/erase) or pan/zoom. */
export type TouchIntent = 'draw' | 'navigate';
/**
* Which policy a touch falls under. It only draws when finger ink is on and it
* didn't land on a button; taps on buttons (e.g. add page) navigate, so they keep
* working between pen strokes.
*/
export function touchIntent(fingerInks: boolean, onButton: boolean): TouchIntent {
return fingerInks && !onButton ? 'draw' : 'navigate';
}
export interface Decision {
accept: boolean;
reason: string;