diff --git a/frontend/src/components/ContextMenu.vue b/frontend/src/components/ContextMenu.vue index b709df08..14663fd9 100644 --- a/frontend/src/components/ContextMenu.vue +++ b/frontend/src/components/ContextMenu.vue @@ -4,7 +4,7 @@ ref="contextMenu" v-show="show" :style="{ - top: `${top}px`, + top: `${props.pos.y}px`, left: `${left}px`, }" > @@ -19,13 +19,6 @@ const emit = defineEmits(["hide"]); const props = defineProps<{ show: boolean; pos: { x: number; y: number } }>(); const contextMenu = ref(null); -const top = computed(() => { - return Math.min( - props.pos.y, - window.innerHeight - (contextMenu.value?.clientHeight ?? 0) - ); -}); - const left = computed(() => { return Math.min( props.pos.x, diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue index 362c940c..932bc4b1 100644 --- a/frontend/src/components/files/ListingItem.vue +++ b/frontend/src/components/files/ListingItem.vue @@ -222,21 +222,12 @@ const itemClick = (event: Event | KeyboardEvent) => { }; const contextMenu = (event: MouseEvent) => { - const to = setTimeout(() => { - touches.value = 0; - }, 300); - - touches.value++; - if (touches.value > 1) return; - event.preventDefault(); if ( - fileStore.selected.length < 2 || + fileStore.selected.length === 0 || event.ctrlKey || fileStore.selected.indexOf(props.index) === -1 ) { - touches.value--; - clearTimeout(to); click(event); } }; diff --git a/frontend/src/css/context-menu.css b/frontend/src/css/context-menu.css index 825643f6..cd791364 100644 --- a/frontend/src/css/context-menu.css +++ b/frontend/src/css/context-menu.css @@ -1,10 +1,11 @@ .context-menu { - position: fixed; + position: absolute; background: var(--surfacePrimary); min-width: 180px; + max-width: 220px; border: 1px solid var(--borderSecondary); box-shadow: 0 2px 4px var(--borderPrimary); - z-index: 1000; + z-index: 999; } .context-menu .action { diff --git a/frontend/src/views/files/FileListing.vue b/frontend/src/views/files/FileListing.vue index 3cda761c..e5e929e3 100644 --- a/frontend/src/views/files/FileListing.vue +++ b/frontend/src/views/files/FileListing.vue @@ -205,92 +205,96 @@ - -

- {{ t("files.folders") }} -

-
- - -
- -

- {{ t("files.files") }} -

-
- - -
- + {{ t("files.folders") }} + +
+ - - - - - - - - - + +
+ +

+ {{ t("files.files") }} +

+
+ + +
+ + + + + + + + + { }; const showContextMenu = (event: MouseEvent) => { + event.preventDefault(); isContextMenuVisible.value = true; contextMenuPos.value = { - x: event.clientX, - y: event.clientY, + x: event.clientX + 8, + y: event.clientY + Math.floor(window.scrollY), }; };