mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-28 08:42:47 -04:00
Improved flow of observables/emissions
This commit is contained in:
@@ -93,9 +93,11 @@ export function watchViewport(): Observable<Viewport> {
|
||||
export function watchViewportAt(
|
||||
el: HTMLElement, { header$, viewport$ }: WatchAtOptions
|
||||
): Observable<Viewport> {
|
||||
const offset$ = viewport$
|
||||
const offset$ = combineLatest([
|
||||
viewport$.pipe(distinctUntilKeyChanged("size")),
|
||||
header$
|
||||
])
|
||||
.pipe(
|
||||
distinctUntilKeyChanged("size"),
|
||||
map((): ViewportOffset => ({
|
||||
x: el.offsetLeft,
|
||||
y: el.offsetTop
|
||||
|
||||
Reference in New Issue
Block a user