From 1332fd230b5bc67349fed9e595c3e032531776e9 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Sat, 4 Jun 2022 20:42:07 +0200 Subject: [PATCH 1/3] IntersectionObserver at 1/3 screen --- src/sphinx_book_theme/assets/scripts/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sphinx_book_theme/assets/scripts/index.js b/src/sphinx_book_theme/assets/scripts/index.js index a5b2a594..2c20d6bd 100644 --- a/src/sphinx_book_theme/assets/scripts/index.js +++ b/src/sphinx_book_theme/assets/scripts/index.js @@ -131,7 +131,11 @@ var initTocHide = () => { }; // Set up the intersection observer to watch all margin content - let tocObserver = new IntersectionObserver(hideTocCallback); + let options = { + // This makes the event trigger when the top of an item is mid-way + rootMargin: "0px 0px -33% 0px", + }; + let tocObserver = new IntersectionObserver(hideTocCallback, options); // TODO: deprecate popout after v0.5.0 const selectorClasses = [ "marginnote", From 0d08e1b0f4da9814762f9856335fd2436062908f Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Sat, 4 Jun 2022 11:51:38 -0700 Subject: [PATCH 2/3] Update src/sphinx_book_theme/assets/scripts/index.js --- src/sphinx_book_theme/assets/scripts/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphinx_book_theme/assets/scripts/index.js b/src/sphinx_book_theme/assets/scripts/index.js index 2c20d6bd..d3238aee 100644 --- a/src/sphinx_book_theme/assets/scripts/index.js +++ b/src/sphinx_book_theme/assets/scripts/index.js @@ -132,7 +132,7 @@ var initTocHide = () => { // Set up the intersection observer to watch all margin content let options = { - // This makes the event trigger when the top of an item is mid-way + // Trigger callback when the top of a margin item is 1/3 up the screen rootMargin: "0px 0px -33% 0px", }; let tocObserver = new IntersectionObserver(hideTocCallback, options); From 77bcf193d67d38e8c7a15d219cbe2adaea91b973 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Sat, 4 Jun 2022 20:52:48 +0200 Subject: [PATCH 3/3] Filesystem --- ARCHITECTURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 37ad6e13..257b3ae8 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -2,7 +2,7 @@ This is a short overview of the general architecture and structure of the repository, to help you orient yourself. -This theme uses [sphinx-theme-builder](https://sphinx-theme-builder.readthedocs.io/en/latest/) as its build backend, and follows the [filesystem layout](https://sphinx-theme-builder.readthedocs.io/en/latest/reference/filesystem-layout/) recommended by it. +This theme uses [sphinx-theme-builder](https://sphinx-theme-builder.readthedocs.io/en/latest/) as its build backend, and follows the [filesystem layout](https://sphinx-theme-builder.readthedocs.io/en/latest/filesystem-layout/) recommended by it. See below for some more specific sections ```{contents}