Skip to content

fix: unify scroll anchor and add smooth-mode lookahead - #73

Open
samgutentag wants to merge 1 commit into
f:masterfrom
samgutentag:fix/scroll-anchor-lookahead
Open

fix: unify scroll anchor and add smooth-mode lookahead#73
samgutentag wants to merge 1 commit into
f:masterfrom
samgutentag:fix/scroll-anchor-lookahead

Conversation

@samgutentag

Copy link
Copy Markdown
Contributor

Supersedes #64.

Two coupled scroll bugs in smooth modes (classic / silence-paused), one file (MarqueeTextView.swift):

1. Anchor mismatch on manual-scroll release. recalcCenter() anchors the active word and wordProgressAtCurrentOffset() reads the word back at a reference line, but the two used different reference points — the active word was anchored near the bottom edge while the resume path read from the vertical center. Releasing a manual scroll snapped the text by roughly half the window height. Both now share one readingAnchorY() helper.

2. No lookahead. The smooth-mode anchor sat 20pt above the bottom, so any word past the timer position was below the visible window. It now sits at 70% of viewport height, keeping a couple of upcoming lines visible. Word-tracking mode is unchanged (active word still centered).

Relationship to #64: this is the still-relevant half of #64, rebased onto current master as a single commit. The other two fixes there were independently superseded upstream — the word-level-matcher-on-divergence fix by the SpeechTextAlignment.bestOffset refactor, and the isSpeaking hysteresis by VoiceActivityDetector.

Built green on master (1.6.2); verified by manual scroll + release in both smooth modes.

recalcCenter() anchors the active word, and wordProgressAtCurrentOffset()
reads the word back at a reference line — but the two disagreed. Smooth
modes (classic/silence-paused) anchored near the bottom edge while the
resume path read from the vertical center, so releasing a manual scroll
snapped the text by ~half the window height. Both now share a single
readingAnchorY() helper.

The smooth-mode anchor also sat 20pt above the bottom, giving the
speaker zero lookahead — any word past the timer was below the window.
It now sits at 70% of viewport height so a couple of upcoming lines stay
visible. Word-tracking mode is unchanged (active word still centered).

This is the still-relevant half of the original f#64. The other two
fixes in that PR — preferring the word-level matcher on divergence, and
isSpeaking hysteresis — were independently superseded upstream by the
SpeechTextAlignment.bestOffset refactor and the VoiceActivityDetector.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant