Formatting

This commit is contained in:
squidfunk 2020-03-29 14:01:27 +02:00
parent 7b6ce2a913
commit 7e42f78e92
2 changed files with 5 additions and 5 deletions

View File

@ -88,8 +88,8 @@ export function watchMain(
shareReplay(1) shareReplay(1)
) )
/* Compute the main area's top and bottom markers */ /* Compute the main area's top and bottom borders */
const marker$ = adjust$ const border$ = adjust$
.pipe( .pipe(
switchMap(() => watchElementSize(el) switchMap(() => watchElementSize(el)
.pipe( .pipe(
@ -104,7 +104,7 @@ export function watchMain(
) )
/* Compute the main area's offset, visible height and if we scrolled past */ /* Compute the main area's offset, visible height and if we scrolled past */
return combineLatest([adjust$, marker$, viewport$]) return combineLatest([adjust$, border$, viewport$])
.pipe( .pipe(
map(([header, { top, bottom }, { offset: { y }, size: { height } }]) => { map(([header, { top, bottom }, { offset: { y }, size: { height } }]) => {
height = Math.max(0, height height = Math.max(0, height
@ -114,7 +114,7 @@ export function watchMain(
return { return {
offset: top - header, offset: top - header,
height, height,
active: y >= top - header active: top - header <= y
} }
}), }),
distinctUntilChanged<Main>((a, b) => { distinctUntilChanged<Main>((a, b) => {

View File

@ -96,7 +96,7 @@ interface MountOptions {
* @return Operator function * @return Operator function
*/ */
export function mountTableOfContents( export function mountTableOfContents(
{ header$, main$, viewport$, tablet$}: MountOptions { header$, main$, viewport$, tablet$ }: MountOptions
): OperatorFunction<HTMLElement, TableOfContents> { ): OperatorFunction<HTMLElement, TableOfContents> {
return pipe( return pipe(
switchMap(el => tablet$ switchMap(el => tablet$