Skip to content

Commit

Permalink
load more on touch move
Browse files Browse the repository at this point in the history
  • Loading branch information
gantoine committed Feb 24, 2025
1 parent fd05737 commit ea4746f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontend/src/views/Gallery/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ onMounted(async () => {
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
}
},
{ immediate: true }, // Ensure watcher is triggered immediately
Expand Down Expand Up @@ -277,6 +278,7 @@ onMounted(async () => {
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
}
},
{ immediate: true }, // Ensure watcher is triggered immediately
Expand Down Expand Up @@ -344,6 +346,7 @@ onBeforeRouteUpdate(async (to, from) => {
onBeforeUnmount(() => {
window.removeEventListener("wheel", onScroll);
window.removeEventListener("scroll", onScroll);
window.removeEventListener("touchmove", onScroll);
});
</script>

Expand Down
4 changes: 4 additions & 0 deletions frontend/src/views/Gallery/Platform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ function onGameTouchEnd() {
function onScroll() {
if (galleryViewStore.currentView != 2) {
clearTimeout(timeout);
window.setTimeout(async () => {
const { scrollTop, scrollHeight, clientHeight } =
document.documentElement;
Expand Down Expand Up @@ -252,6 +254,7 @@ onMounted(async () => {
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
} else {
noPlatformError.value = true;
}
Expand Down Expand Up @@ -298,6 +301,7 @@ onBeforeRouteUpdate(async (to, from) => {
onBeforeUnmount(() => {
window.removeEventListener("wheel", onScroll);
window.removeEventListener("scroll", onScroll);
window.removeEventListener("touchmove", onScroll);
});
</script>

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/Gallery/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ onMounted(async () => {
resetGallery();
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
});
onBeforeUnmount(() => {
window.removeEventListener("wheel", onScroll);
window.removeEventListener("scroll", onScroll);
window.removeEventListener("touchmove", onScroll);
searchText.value = "";
});
</script>
Expand Down

0 comments on commit ea4746f

Please sign in to comment.