diff --git a/frontend/src/components/Details/ActionBar.vue b/frontend/src/components/Details/ActionBar.vue index cc33f9dcd..d0624adf9 100644 --- a/frontend/src/components/Details/ActionBar.vue +++ b/frontend/src/components/Details/ActionBar.vue @@ -80,6 +80,7 @@ function toggleEmulation() { + diff --git a/frontend/src/components/Gallery/FabMenu/Base.vue b/frontend/src/components/Gallery/FabMenu/Base.vue index 04849e469..d5dae7ef1 100644 --- a/frontend/src/components/Gallery/FabMenu/Base.vue +++ b/frontend/src/components/Gallery/FabMenu/Base.vue @@ -37,12 +37,12 @@ async function onScan() { } function selectAllRoms() { - if (romsStore.filteredRoms.length === romsStore.selectedRoms.length) { - romsStore.resetSelection(); - emitter?.emit("openFabMenu", false); - } else { - romsStore.setSelection(romsStore.filteredRoms); - } + romsStore.setSelection(romsStore.filteredRoms); +} + +function resetSelection() { + romsStore.resetSelection(); + emitter?.emit("openFabMenu", false); } function onDownload() { @@ -53,47 +53,103 @@ function onDownload() { + + diff --git a/frontend/src/components/Game/Card/Cover.vue b/frontend/src/components/Game/Card/Cover.vue index c2fcc1908..48942c45e 100644 --- a/frontend/src/components/Game/Card/Cover.vue +++ b/frontend/src/components/Game/Card/Cover.vue @@ -7,6 +7,7 @@ import { identity, isNull } from "lodash"; import { ref } from "vue"; import { useTheme } from "vuetify"; +// Props defineProps<{ rom: Rom; isHoveringTop: boolean; @@ -28,21 +29,15 @@ const showLanguages = isNull(localStorage.getItem("settings.showLanguages")) const showSiblings = isNull(localStorage.getItem("settings.showSiblings")) ? true : localStorage.getItem("settings.showSiblings") === "true"; - let timeout: ReturnType; -// Functions -function onSelectRom(event: MouseEvent) { - if (!event.ctrlKey && !event.shiftKey) { - event.preventDefault(); - emit("selectRom", event); - } -} +// Functions function onNavigate(event: MouseEvent) { if ( event.ctrlKey || event.shiftKey || - (romsStore.touchScreen && romsStore.selectedRoms.length > 0) + romsStore.selecting || + romsStore.selectedRoms.length > 0 ) { event.preventDefault(); event.stopPropagation(); @@ -54,7 +49,6 @@ function onTouchStart(event: TouchEvent) { card.value.$el.addEventListener("contextmenu", (event: Event) => { event.preventDefault(); }); - romsStore.isTouchScreen(true); timeout = setTimeout(() => { emit("selectRom", event); }, 500); @@ -69,7 +63,7 @@ function onTouchEnd() { - {{ rom.name }} @@ -161,14 +154,6 @@ function onTouchEnd() { +{{ rom.siblings.length }} - {{ selected ? "mdi-circle-slice-8" : "mdi-circle-outline" }} diff --git a/frontend/src/stores/roms.ts b/frontend/src/stores/roms.ts index bfe256442..04c761ca7 100644 --- a/frontend/src/stores/roms.ts +++ b/frontend/src/stores/roms.ts @@ -23,7 +23,7 @@ export default defineStore("roms", { lastSelectedIndex: -1, cursor: "" as string | null, searchCursor: "" as string | null, - touchScreen: false, + selecting: false, }), getters: { @@ -54,9 +54,11 @@ export default defineStore("roms", { // Group roms by external id this._grouped = Object.values( - groupBy(this._all, (game) => - // If external id is null, generate a random id so that the roms are not grouped - game.igdb_id || game.moby_id || nanoid() + groupBy( + this._all, + (game) => + // If external id is null, generate a random id so that the roms are not grouped + game.igdb_id || game.moby_id || nanoid() ) ) .map((games) => ({ @@ -180,8 +182,8 @@ export default defineStore("roms", { updateLastSelected(index: number) { this.lastSelectedIndex = index; }, - isTouchScreen(touchScreen: boolean) { - this.touchScreen = touchScreen; + isSelecting() { + this.selecting = !this.selecting; }, resetSelection() { this._selectedIDs = [];