mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat(web): hero view transitions between timeline and asset viewer
Change-Id: I19e0c7385cc38adbc85177ae9706cff06a6a6964 fix(web): fix e2e test failures for view transitions Change-Id: Ida64f2d509efce0a85a50b89fd4137276a6a6964 Change-Id: I19e0c7385cc38adbc85177ae9706cff06a6a6964
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user