Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better heuristic for determining active clause #526

Merged
merged 4 commits into from
May 4, 2023
Merged

Conversation

michaelficarra
Copy link
Member

@michaelficarra michaelficarra commented Apr 29, 2023

I got frustrated by the TOC not always correctly determining the clause that I was reading. Experimentally, this heuristic works very well. It chooses either the first clause that is fully visible (except when at the bottom of the viewport) or, if there are none, the clause that straddles the vertical midpoint of the viewport. This has the helpful property that clicking the TOC item always ends up marking that item as active (except possibly the very final clause(s) of the document).

edit: For reference, the previous heuristic was that the clause straddled the top of the viewport, meaning the active clause was often mostly out of view.

@michaelficarra michaelficarra requested a review from bakkot April 29, 2023 02:40
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.

2 participants