rename to windowy

This commit is contained in:
Georges-Antoine Assi
2025-12-29 17:56:50 -05:00
parent 9393069515
commit 44b6aca015
5 changed files with 19 additions and 23 deletions

View File

@@ -30,12 +30,12 @@ function onHover(emitData: { isHovering: boolean; id: number }) {
hoveringCollectionId.value = emitData.id;
}
const { y: documentY } = useScroll(window, { throttle: 100 });
const { y: windowY } = useScroll(window, { throttle: 100 });
// Watch for scroll changes and trigger the throttled function
watch(documentY, () => {
watch(windowY, () => {
if (
documentY.value + window.innerHeight >= document.body.scrollHeight - 300 &&
windowY.value + window.innerHeight >= document.body.scrollHeight - 300 &&
visibleCollections.value < props.collections.length
) {
visibleCollections.value += 72;

View File

@@ -136,16 +136,15 @@ function onGameTouchEnd() {
clearTimeout(timeout);
}
const { y: documentY } = useScroll(window, { throttle: 500 });
const { y: windowY } = useScroll(window, { throttle: 500 });
watch(documentY, () => {
watch(windowY, () => {
clearTimeout(timeout);
window.setTimeout(async () => {
scrolledToTop.value = documentY.value === 0;
scrolledToTop.value = windowY.value === 0;
if (
documentY.value + window.innerHeight >=
document.body.scrollHeight - 300 &&
windowY.value + window.innerHeight >= document.body.scrollHeight - 300 &&
fetchTotalRoms.value > filteredRoms.value.length
) {
await fetchRoms();

View File

@@ -116,16 +116,15 @@ function onGameTouchEnd() {
clearTimeout(timeout);
}
const { y: documentY } = useScroll(window, { throttle: 500 });
const { y: windowY } = useScroll(window, { throttle: 500 });
watch(documentY, () => {
watch(windowY, () => {
clearTimeout(timeout);
window.setTimeout(async () => {
scrolledToTop.value = documentY.value === 0;
scrolledToTop.value = windowY.value === 0;
if (
documentY.value + window.innerHeight >=
document.body.scrollHeight - 300 &&
windowY.value + window.innerHeight >= document.body.scrollHeight - 300 &&
fetchTotalRoms.value > filteredRoms.value.length
) {
await fetchRoms();

View File

@@ -114,16 +114,15 @@ function fetchRoms() {
});
}
const { y: documentY } = useScroll(window, { throttle: 500 });
const { y: windowY } = useScroll(window, { throttle: 500 });
watch(documentY, () => {
watch(windowY, () => {
clearTimeout(timeout);
window.setTimeout(async () => {
scrolledToTop.value = documentY.value === 0;
scrolledToTop.value = windowY.value === 0;
if (
documentY.value + window.innerHeight >=
document.body.scrollHeight - 300 &&
windowY.value + window.innerHeight >= document.body.scrollHeight - 300 &&
fetchTotalRoms.value > filteredRoms.value.length
) {
await fetchRoms();

View File

@@ -161,7 +161,7 @@ function resetMissingRoms() {
galleryFilterStore.resetFilters();
}
const { y: documentY } = useScroll(window, { throttle: 500 });
const { y: windowY } = useScroll(window, { throttle: 500 });
// Watch for tab changes and update URL
watch(tab, (newTab) => {
@@ -185,14 +185,13 @@ watch(
{ immediate: true },
);
watch(documentY, () => {
watch(windowY, () => {
clearTimeout(timeout);
window.setTimeout(async () => {
scrolledToTop.value = documentY.value === 0;
scrolledToTop.value = windowY.value === 0;
if (
documentY.value + window.innerHeight >=
document.body.scrollHeight - 300 &&
windowY.value + window.innerHeight >= document.body.scrollHeight - 300 &&
fetchTotalRoms.value > filteredRoms.value.length
) {
await fetchRoms();