mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
test
This commit is contained in:
parent
dccf33af2d
commit
34dc43189f
@ -22,6 +22,7 @@
|
|||||||
import type { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
import type { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es';
|
||||||
import { getJustifiedLayoutFromAssets, type CommonJustifiedLayout } from '$lib/utils/layout-utils';
|
import { getJustifiedLayoutFromAssets, type CommonJustifiedLayout } from '$lib/utils/layout-utils';
|
||||||
|
import { focusNext } from '$lib/utils/focus-util';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
assets: AssetResponseDto[];
|
assets: AssetResponseDto[];
|
||||||
@ -259,25 +260,8 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const focusNextAsset = () => {
|
const focusNextAsset = () => focusNext((element) => element.dataset.thumbnailFocusContainer !== undefined, true);
|
||||||
if (assetInteraction.focussedAssetId === null && assets.length > 0) {
|
const focusPreviousAsset = () => focusNext((element) => element.dataset.thumbnailFocusContainer !== undefined, false);
|
||||||
assetInteraction.focussedAssetId = assets[0].id;
|
|
||||||
} else if (assetInteraction.focussedAssetId !== null && assets.length > 0) {
|
|
||||||
const currentIndex = assets.findIndex((a) => a.id === assetInteraction.focussedAssetId);
|
|
||||||
if (currentIndex !== -1 && currentIndex + 1 < assets.length) {
|
|
||||||
assetInteraction.focussedAssetId = assets[currentIndex + 1].id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const focusPreviousAsset = () => {
|
|
||||||
if (assetInteraction.focussedAssetId !== null && assets.length > 0) {
|
|
||||||
const currentIndex = assets.findIndex((a) => a.id === assetInteraction.focussedAssetId);
|
|
||||||
if (currentIndex >= 1) {
|
|
||||||
assetInteraction.focussedAssetId = assets[currentIndex - 1].id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let shortcutList = $derived(
|
let shortcutList = $derived(
|
||||||
(() => {
|
(() => {
|
||||||
@ -417,10 +401,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const assetOnFocusHandler = (asset: AssetResponseDto) => {
|
|
||||||
assetInteraction.focussedAssetId = asset.id;
|
|
||||||
};
|
|
||||||
|
|
||||||
let isTrashEnabled = $derived($featureFlags.loaded && $featureFlags.trash);
|
let isTrashEnabled = $derived($featureFlags.loaded && $featureFlags.trash);
|
||||||
let idsSelectedAssets = $derived(assetInteraction.selectedAssets.map(({ id }) => id));
|
let idsSelectedAssets = $derived(assetInteraction.selectedAssets.map(({ id }) => id));
|
||||||
|
|
||||||
@ -490,12 +470,10 @@
|
|||||||
}}
|
}}
|
||||||
onSelect={(asset) => handleSelectAssets(asset)}
|
onSelect={(asset) => handleSelectAssets(asset)}
|
||||||
onMouseEvent={() => assetMouseEventHandler(asset)}
|
onMouseEvent={() => assetMouseEventHandler(asset)}
|
||||||
handleFocus={() => assetOnFocusHandler(asset)}
|
|
||||||
{showArchiveIcon}
|
{showArchiveIcon}
|
||||||
{asset}
|
{asset}
|
||||||
selected={assetInteraction.hasSelectedAsset(asset.id)}
|
selected={assetInteraction.hasSelectedAsset(asset.id)}
|
||||||
selectionCandidate={assetInteraction.hasSelectionCandidate(asset.id)}
|
selectionCandidate={assetInteraction.hasSelectionCandidate(asset.id)}
|
||||||
focussed={assetInteraction.isFocussedAsset(asset.id)}
|
|
||||||
thumbnailWidth={layout.width}
|
thumbnailWidth={layout.width}
|
||||||
thumbnailHeight={layout.height}
|
thumbnailHeight={layout.height}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user