aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/components/FilesListVirtual.vue
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-10-18 11:08:25 +0200
committernextcloud-command <nextcloud-command@users.noreply.github.com>2023-10-19 06:42:33 +0000
commit4db03884a566bc637e859cb83c806201b326bb3c (patch)
treec208dd414fcbeaf2da03d9132730ddcea4913f72 /apps/files/src/components/FilesListVirtual.vue
parent4876eacf3fee0f4bbbaa70f924e5429133f1d1bd (diff)
downloadnextcloud-server-4db03884a566bc637e859cb83c806201b326bb3c.tar.gz
nextcloud-server-4db03884a566bc637e859cb83c806201b326bb3c.zip
fix(files): drop visible and adjust drag-to-scroll feature
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/files/src/components/FilesListVirtual.vue')
-rw-r--r--apps/files/src/components/FilesListVirtual.vue13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue
index 5719f361680..5aff5f92316 100644
--- a/apps/files/src/components/FilesListVirtual.vue
+++ b/apps/files/src/components/FilesListVirtual.vue
@@ -259,18 +259,17 @@ export default Vue.extend({
event.preventDefault()
event.stopPropagation()
- // If reaching top, scroll up
- const firstVisible = this.$refs.table?.$el?.querySelector('.files-list__row--visible') as HTMLElement
- const firstSibling = firstVisible?.previousElementSibling as HTMLElement
- if ([firstVisible, firstSibling].some(elmt => elmt?.contains(event.target as Node))) {
+ const tableTop = this.$refs.table.$el.getBoundingClientRect().top
+ const tableBottom = tableTop + this.$refs.table.$el.getBoundingClientRect().height
+
+ // If reaching top, scroll up. Using 100 because of the floating header
+ if (event.clientY < tableTop + 100) {
this.$refs.table.$el.scrollTop = this.$refs.table.$el.scrollTop - 25
return
}
// If reaching bottom, scroll down
- const lastVisible = [...(this.$refs.table?.$el?.querySelectorAll('.files-list__row--visible') || [])].pop() as HTMLElement
- const nextSibling = lastVisible?.nextElementSibling as HTMLElement
- if ([lastVisible, nextSibling].some(elmt => elmt?.contains(event.target as Node))) {
+ if (event.clientY > tableBottom - 50) {
this.$refs.table.$el.scrollTop = this.$refs.table.$el.scrollTop + 25
}
},