Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Keep photo viewer header gradients aligned during zoom

Anand Baburajan99858bc89e9b
diff --git a/web/apps/space/src/components/viewer-transition.ts b/web/apps/space/src/components/viewer-transition.ts
index 710bdb772b..7f8034f3c7 100644
--- a/web/apps/space/src/components/viewer-transition.ts
+++ b/web/apps/space/src/components/viewer-transition.ts
@@ -171,26 +171,35 @@ const createRider = (flyer: HTMLElement, tile: HTMLElement) => {
if (element instanceof HTMLElement)
element.style.animation = "none";
Object.assign(rider.style, {
- borderRadius: getComputedStyle(tile).borderRadius,
height: `${bounds.h}px`,
- left: `${bounds.x}px`,
+ left: "0",
overflow: "hidden",
pointerEvents: "none",
position: "absolute",
- top: `${bounds.y}px`,
+ top: "0",
+ transformOrigin: "0 0",
width: `${bounds.w}px`,
+ willChange: "transform",
zIndex: "2",
});
flyer.after(rider);
header.style.opacity = "0";
+ shade.style.opacity = "0";
return {
element: rider,
- draw: (_state: ViewerPhotoState, t: number) => {
- rider.style.opacity = String(1 - viewerBackgroundOpacity(t));
+ draw: ({ visible: v, radii }: ViewerPhotoState, t: number) => {
+ const sx = v.w / bounds.w;
+ const sy = v.h / bounds.h;
+ rider.style.transform = `translate3d(${v.x}px, ${v.y}px, 0) scale(${sx}, ${sy})`;
+ rider.style.borderRadius = `${radii.map((radius) => `${radius / sx}px`).join(" ")} / ${radii.map((radius) => `${radius / sy}px`).join(" ")}`;
+ rider.style.opacity = String(
+ 1 - viewerBackgroundOpacity(t / 0.35),
+ );
},
remove: () => rider.remove(),
reveal: () => {
header.style.opacity = "";
+ shade.style.opacity = "";
},
};
}