summaryrefslogtreecommitdiffstats
path: root/apps/files/src/components/FileEntry.vue
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-12-27 16:26:13 +0100
committerEduardo Morales <emoral435@gmail.com>2024-01-03 13:59:28 -0600
commit820b2beb6b90cb891ee5edecb65b9b4214cb7500 (patch)
tree2d5f0502cef8be1679e7053ae981f92224e5f215 /apps/files/src/components/FileEntry.vue
parentc8104266f823ddba5eebca5447acd8502cc4ac4e (diff)
downloadnextcloud-server-820b2beb6b90cb891ee5edecb65b9b4214cb7500.tar.gz
nextcloud-server-820b2beb6b90cb891ee5edecb65b9b4214cb7500.zip
fix(files): open menu on right click position
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src/components/FileEntry.vue')
-rw-r--r--apps/files/src/components/FileEntry.vue16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue
index 3ed8b0a5d4b..a6ca70d2800 100644
--- a/apps/files/src/components/FileEntry.vue
+++ b/apps/files/src/components/FileEntry.vue
@@ -353,6 +353,15 @@ export default defineComponent({
return this.actionsMenuStore.opened === this.uniqueId
},
set(opened) {
+ // Only reset when opening a new menu
+ if (opened) {
+ // Reset any right click position override on close
+ // Wait for css animation to be done
+ const root = this.$root.$el as HTMLElement
+ root.style.removeProperty('--mouse-pos-x')
+ root.style.removeProperty('--mouse-pos-y')
+ }
+
this.actionsMenuStore.opened = opened ? this.uniqueId : null
},
},
@@ -390,6 +399,13 @@ export default defineComponent({
return
}
+ const root = this.$root.$el as HTMLElement
+ const contentRect = root.getBoundingClientRect()
+ // Using Math.min/max to prevent the menu from going out of the AppContent
+ // 200 = max width of the menu
+ root.style.setProperty('--mouse-pos-x', Math.max(contentRect.left, Math.min(event.clientX, event.clientX - 200)) + 'px')
+ root.style.setProperty('--mouse-pos-y', Math.max(contentRect.top, event.clientY - contentRect.top) + 'px')
+
// If the clicked row is in the selection, open global menu
const isMoreThanOneSelected = this.selectedFiles.length > 1
this.actionsMenuStore.opened = this.isSelected && isMoreThanOneSelected ? 'global' : this.uniqueId