mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: handle escape key and higher wheel zoom ratio (#3471)
This commit is contained in:
parent
95c75c289c
commit
e368b9e50b
5 changed files with 63 additions and 12 deletions
|
|
@ -13,7 +13,7 @@
|
|||
UserResponseDto,
|
||||
api,
|
||||
} from '@api';
|
||||
import { onMount } from 'svelte';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte';
|
||||
import DeleteOutline from 'svelte-material-icons/DeleteOutline.svelte';
|
||||
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
|
||||
|
|
@ -43,6 +43,7 @@
|
|||
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
||||
import { handleError } from '../../utils/handle-error';
|
||||
import { downloadArchive } from '../../utils/asset-utils';
|
||||
import { isViewingAssetStoreState } from '$lib/stores/asset-interaction.store';
|
||||
|
||||
export let album: AlbumResponseDto;
|
||||
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
|
||||
|
|
@ -119,7 +120,10 @@
|
|||
return startDateString === endDateString ? startDateString : `${startDateString} - ${endDateString}`;
|
||||
};
|
||||
|
||||
const onKeyboardPress = (event: KeyboardEvent) => handleKeyboardPress(event);
|
||||
|
||||
onMount(async () => {
|
||||
document.addEventListener('keydown', onKeyboardPress);
|
||||
currentAlbumName = album.albumName;
|
||||
|
||||
try {
|
||||
|
|
@ -130,6 +134,26 @@
|
|||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (browser) {
|
||||
document.removeEventListener('keydown', onKeyboardPress);
|
||||
}
|
||||
});
|
||||
|
||||
const handleKeyboardPress = (event: KeyboardEvent) => {
|
||||
if (!$isViewingAssetStoreState) {
|
||||
switch (event.key) {
|
||||
case 'Escape':
|
||||
if (isMultiSelectionMode) {
|
||||
multiSelectAsset = new Set();
|
||||
} else {
|
||||
goto(backUrl);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Update Album Name
|
||||
$: {
|
||||
if (!isEditingTitle && currentAlbumName != album.albumName && isOwned) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue