11import { TogglablesStateStore } from "@/stores/ModalsState" ;
2- import { modKey , shiftKeyState } from "@/utils/keybindings-utils" ;
2+ import { getModKey } from "@/utils/keybindings-utils" ;
33import { storeToRefs } from "pinia" ;
44import { computed , ref } from "vue" ;
55import { useAlbumActions } from "@/composables/album/albumActions" ;
@@ -60,12 +60,19 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
6060 selectedAlbumsIdx . value = selectedAlbumsIdx . value . filter ( ( i ) => i !== idx ) ;
6161 }
6262
63- function photoSelect ( idx : number , e : Event ) : void {
63+ function getMouseModifiers ( e : MouseEvent ) : { isMod : boolean ; isShift : boolean } {
64+ const modKey = getModKey ( ) ;
65+ const isMod = modKey === "Meta" ? e . metaKey : e . ctrlKey ;
66+ return { isMod, isShift : e . shiftKey } ;
67+ }
68+
69+ function photoSelect ( idx : number , e : MouseEvent ) : void {
6470 // clear the Album selection.
6571 selectedAlbumsIdx . value = [ ] ;
6672
6773 // we do not support CTRL + SHIFT
68- if ( ! modKey ( ) . value && ! shiftKeyState . value ) {
74+ const { isMod, isShift } = getMouseModifiers ( e ) ;
75+ if ( ! isMod && ! isShift ) {
6976 return ;
7077 }
7178
@@ -77,12 +84,12 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
7784 return ;
7885 }
7986
80- if ( modKey ( ) . value ) {
87+ if ( isMod ) {
8188 handlePhotoCtrl ( idx , e ) ;
8289 return ;
8390 }
8491
85- if ( shiftKeyState . value ) {
92+ if ( isShift ) {
8693 handlePhotoShift ( idx , e ) ;
8794 return ;
8895 }
@@ -126,12 +133,13 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
126133 lastPhotoClicked . value = idx ;
127134 }
128135
129- function albumClick ( idx : number , e : Event ) : void {
136+ function albumClick ( idx : number , e : MouseEvent ) : void {
130137 // clear the Photo selection.
131138 selectedPhotosIdx . value = [ ] ;
132139
133140 // we do not support CTRL + SHIFT
134- if ( ! modKey ( ) . value && ! shiftKeyState . value ) {
141+ const { isMod, isShift } = getMouseModifiers ( e ) ;
142+ if ( ! isMod && ! isShift ) {
135143 return ;
136144 }
137145
@@ -143,12 +151,12 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
143151 return ;
144152 }
145153
146- if ( modKey ( ) . value ) {
154+ if ( isMod ) {
147155 handleAlbumCtrl ( idx , e ) ;
148156 return ;
149157 }
150158
151- if ( shiftKeyState . value ) {
159+ if ( isShift ) {
152160 handleAlbumShift ( idx , e ) ;
153161 return ;
154162 }
0 commit comments