Fixed incorrect active table of contents item when main size changes

This commit is contained in:
squidfunk
2020-03-29 14:00:53 +02:00
parent 6a0e6142e3
commit 7b6ce2a913
6 changed files with 9 additions and 9 deletions

View File

@@ -41,7 +41,7 @@ import {
tap
} from "rxjs/operators"
import { Viewport, getElement } from "browser"
import { Viewport, getElement, watchElementSize } from "browser"
import { Header } from "../../../header"
import { AnchorList } from "../_"
@@ -106,9 +106,9 @@ export function watchAnchorList(
)
/* Compute partition of previous and next anchors */
const partition$ = viewport$
const partition$ = watchElementSize(document.body)
.pipe(
distinctUntilKeyChanged("size"),
distinctUntilKeyChanged("height"),
/* Build index to map anchor paths to vertical offsets */
map(() => {