feat(android): the eraser shows its reach, and the pen's button toggles it #18
Loading…
Reference in a new issue
No description provided.
Delete branch "test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Erasing rubs out everything within max(8, brushSize * 3) canvas units of the
nib — several times the width of the line it takes, and nothing on screen ever
said so. The only way to find out how much a pass would remove was to make it
and undo. So the eraser now draws a ring at its reach, while the pen hovers and
while it rubs, and the eraser end of a flipped pen shows it whatever the toolbar
says.
The radius comes from one place, eraseRadius(), which eraseAt() also measures
with: the circle is a promise about what the next pass takes, and two copies of
that number would eventually disagree. EraserCursorTest asserts the promise
rather than the drawing — nothing survives inside the ring.
InkView draws it over its committed bitmap. LowLatencyInkView puts it in the
Scene instead: that buffer keeps what was last drawn on it, so the only way to
move the ring is to lay the page down again underneath. Sub-unit movement is
dropped so that stays affordable.
The barrel button now toggles rather than erasing only while held — pressing it
once and rubbing out a paragraph is the gesture that was wanted. Pressing again
returns to the tool in hand, text tool included, and the toolbar sets what
"back" means so the two can't disagree.
Three things make the button awkward, all handled in InkEngine: the press
arrives as a touch event, as ACTION_BUTTON_PRESS through onGenericMotionEvent,
or on some digitisers only as button state on the hover stream, so a 0-to-
pressed edge is watched for in all three; watching the edge rather than the
level is what stops a held button toggling on every sample; and because
DayScreen owns the tool across a day's several surfaces, onStylusButton answers
synchronously with the new tool so a button pressed with the pen already down
affects that stroke instead of the one after it.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com