Pinch-to-font-size (continuous, content-point pinned) + IME-open scroll fix
Two feature bodies accumulated in the working tree:
1. Pinch to change the app font size, continuously (no snapping):
- internal/ui/pinch_tracker.go: logic-free touch state machine.
Two-mover formation (the resting palm can land first or last;
movement is the only signal valid for both), pair = the mover
pair whose distance changed most, baseline = press distance
(formDist), lazy pending releases, survivor-scroll forwarding
after a pair break. Robust to ~1 fps frames: a whole pinch can
land in one drain (formDist/brokeFactor/lazy releases).
- render.go: pinch probe (raw pointer events) + grab lifecycle so
the pair is exclusive (scroll sees nothing of the pair) and the
survivor's finger keeps working as a scroll after the pinch.
- state.go/logic.go/session.go/frame.go: app-local float font
scale, content-point pin (buffer byte + offset from baseline,
not a layout point, so rewrap keeps the same character under
the center), restore/font pins, session persistence.
- pinch_test.go, pinch_font_test.go, tag_identity_test.go,
real_draw_probe_test.go: unit + real-Renderer/real-Router tests.
2. Soft keyboard must not shift content:
- Root cause: gioui.org/app calls Router.RevealFocus on any frame
the viewport shrinks (IME open under adjustResize) and
synthesizes a pointer.Scroll nudge aimed at the focused field's
stale pre-resize bounds; gesture.Scroll consumed it -> a 32 dp
content jump.
- Fix: main.go flags the shrink frame; render.go drains that one
synthetic scroll for the gesture's tag before Update (scroll-
range clamping cannot work: the router UNIONs ranges across
frames). Finger scroll (pointer.Drag) and the flinger are
untouched. reveal_focus_drain_test.go reproduces RevealFocus at
the router level and verifies the drain + zero delta.
Also: tools/touchinject (platform-signed emulator multi-touch
injection harness + e2e script, adb has no two-finger input),
docs (spec 2.2 + development_plan 18-20), .gitignore, gofmt.
This commit is contained in:
+9
-4
@@ -16,7 +16,11 @@
|
||||
# # first tap right after launch/open is
|
||||
# # sometimes swallowed — re-tap.
|
||||
# scripts/emu.sh type TEXT # type into the focused field (spaces ok)
|
||||
# scripts/emu.sh cmd <top|bottom|frac F|dp N> # one-shot editor debug command
|
||||
# scripts/emu.sh cmd <top|bottom|frac F|dp N|pinch F|fontsize F>
|
||||
# # one-shot editor debug command
|
||||
# # (pinch F = relative app font scale
|
||||
# # anchored at the region center;
|
||||
# # fontsize F = absolute, top-anchored)
|
||||
# scripts/emu.sh perf on|off # enable/disable the in-app profiler
|
||||
# scripts/emu.sh perf pull [FILE] # pull logic_frames.csv (default ./logic_frames.csv)
|
||||
# scripts/emu.sh push FILE # push FILE -> /storage/emulated/0/Notes/
|
||||
@@ -30,7 +34,8 @@
|
||||
# the CSV is truncated on app relaunch, so pull it before restarting the
|
||||
# app if you are accumulating data.
|
||||
# - One-shot editor debug commands are read from /storage/emulated/0/PadPerf/cmd
|
||||
# (scroll: top | bottom | "frac 0.5" | "dp 1234").
|
||||
# (scroll: top | bottom | "frac 0.5" | "dp 1234"; app font scale:
|
||||
# "pinch 1.1" relative | "fontsize 1.5" absolute).
|
||||
# - Test files go under /storage/emulated/0/Notes/.
|
||||
# - The emulator OOMs above ~2.5 GB RSS on this VM; kill it if it wedges.
|
||||
#
|
||||
@@ -138,7 +143,7 @@ cmd_up() {
|
||||
kill -9 "$qp" 2>/dev/null || true
|
||||
sleep 2
|
||||
fi
|
||||
start_emulator
|
||||
start_emulator "$@"
|
||||
local rc=0
|
||||
wait_device_online "$ONLINE_TIMEOUT" || rc=$?
|
||||
if [ "$rc" -ne 0 ]; then
|
||||
@@ -163,7 +168,7 @@ cmd_up() {
|
||||
sleep 1
|
||||
j=$((j + 1))
|
||||
done
|
||||
start_emulator -no-snapshot-load
|
||||
start_emulator -no-snapshot-load "$@"
|
||||
# Note: full BOOT_TIMEOUT here — a cold boot legitimately takes far
|
||||
# longer than the ONLINE_TIMEOUT used for the first (snapshot) attempt.
|
||||
wait_device_online "$BOOT_TIMEOUT" || { tail -n 5 "$EMU_LOG" >&2; die "device never came online (cold boot); see $EMU_LOG"; }
|
||||
|
||||
Reference in New Issue
Block a user