scroll...
This commit is contained in:
parent
054ea30955
commit
fd44a29f2b
|
@ -41,7 +41,7 @@
|
|||
import { computed, ComputedRef, isRef, nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted, ref, watch } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as os from '@/os';
|
||||
import { isBottomVisible, isTopVisible, getBodyScrollHeight, getScrollContainer, scrollToBottom, scrollToTop, scroll } from '@/scripts/scroll';
|
||||
import { isBottomVisible, isTopVisible, getScrollContainer, scrollToBottom, scrollToTop, scrollBy } from '@/scripts/scroll';
|
||||
import { useDocumentVisibility } from '@/scripts/use-document-visibility';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { defaultStore } from '@/store';
|
||||
|
@ -428,6 +428,10 @@ function visibilityChange() {
|
|||
timerForSetPause.value = window.setTimeout(() => {
|
||||
isPausingUpdate.value = true;
|
||||
timerForSetPause.value = null;
|
||||
if (!backed) {
|
||||
scrollBy(scrollableElement, { top: 16, behavior: 'instant' });
|
||||
backed = true;
|
||||
}
|
||||
},
|
||||
BACKGROUND_PAUSE_WAIT_SEC * 1000);
|
||||
} else { // 'visible'
|
||||
|
|
|
@ -83,6 +83,19 @@ export function scroll(el: HTMLElement | null, options: ScrollToOptions | undefi
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* コンテナを指定してscrollByする
|
||||
* @param el Container element
|
||||
* @param options ScrollToOptions
|
||||
*/
|
||||
export function scrollBy(el: HTMLElement | null, options: ScrollToOptions | undefined) {
|
||||
if (el == null) {
|
||||
window.scrollBy(options);
|
||||
} else {
|
||||
el.scrollBy(options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll to Top
|
||||
* @param el Scroll container element
|
||||
|
|
Loading…
Reference in a new issue