mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
4f33aed350
Change-Id: I19e0c7385cc38adbc85177ae9706cff06a6a6964 fix(web): fix e2e test failures for view transitions Change-Id: Ida64f2d509efce0a85a50b89fd4137276a6a6964 Change-Id: I19e0c7385cc38adbc85177ae9706cff06a6a6964
26 lines
806 B
TypeScript
26 lines
806 B
TypeScript
import { assetViewerManager } from '$lib/managers/asset-viewer-manager.svelte';
|
|
import { viewTransitionManager } from '$lib/managers/ViewTransitionManager.svelte';
|
|
import { tick } from 'svelte';
|
|
|
|
export function startViewerTransition(
|
|
heroAssetId: string,
|
|
openViewer: () => void,
|
|
activateHeroAsset: (assetId: string) => void,
|
|
deactivateHeroAsset: () => void,
|
|
) {
|
|
void viewTransitionManager.startTransition({
|
|
types: ['viewer'],
|
|
prepareOldSnapshot: () => {
|
|
activateHeroAsset(heroAssetId);
|
|
},
|
|
performUpdate: async (signal) => {
|
|
deactivateHeroAsset();
|
|
const ready = assetViewerManager.untilNext('ViewerOpenTransitionReady', { signal });
|
|
openViewer();
|
|
await ready;
|
|
assetViewerManager.emit('ViewerOpenTransition');
|
|
await tick();
|
|
},
|
|
});
|
|
}
|