scroll...
This commit is contained in:
		| @@ -41,7 +41,7 @@ | |||||||
| import { computed, ComputedRef, isRef, nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted, ref, watch } from 'vue'; | import { computed, ComputedRef, isRef, nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted, ref, watch } from 'vue'; | ||||||
| import * as misskey from 'misskey-js'; | import * as misskey from 'misskey-js'; | ||||||
| import * as os from '@/os'; | 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 { useDocumentVisibility } from '@/scripts/use-document-visibility'; | ||||||
| import MkButton from '@/components/MkButton.vue'; | import MkButton from '@/components/MkButton.vue'; | ||||||
| import { defaultStore } from '@/store'; | import { defaultStore } from '@/store'; | ||||||
| @@ -428,6 +428,10 @@ function visibilityChange() { | |||||||
| 		timerForSetPause.value = window.setTimeout(() => { | 		timerForSetPause.value = window.setTimeout(() => { | ||||||
| 			isPausingUpdate.value = true; | 			isPausingUpdate.value = true; | ||||||
| 			timerForSetPause.value = null; | 			timerForSetPause.value = null; | ||||||
|  | 			if (!backed) { | ||||||
|  | 				scrollBy(scrollableElement, { top: 16, behavior: 'instant' }); | ||||||
|  | 				backed = true; | ||||||
|  | 			} | ||||||
| 		}, | 		}, | ||||||
| 		BACKGROUND_PAUSE_WAIT_SEC * 1000); | 		BACKGROUND_PAUSE_WAIT_SEC * 1000); | ||||||
| 	} else { // 'visible' | 	} 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 |  * Scroll to Top | ||||||
|  * @param el Scroll container element |  * @param el Scroll container element | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 tamaina
					tamaina