Naslovnica: zaris obraza se zdaj ujame tudi pri absolutnih URL-jih (kvadratne ploscice ne rezejo glav)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { artistGroup } from "@/lib/artists";
|
import { artistGroup } from "@/lib/artists";
|
||||||
|
import { objectPositionFor } from "@/lib/focal";
|
||||||
import { Link } from "wouter";
|
import { Link } from "wouter";
|
||||||
import { type Article } from "@shared/schema";
|
import { type Article } from "@shared/schema";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
@@ -142,11 +143,14 @@ function GalleryHeroCard({ images }: { images: GalleryImage[] }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zaris naslovnice. Kljuci v /api/focal-points so relativni (/uploads/x.webp),
|
||||||
|
* coverImage pa je pogosto absoluten (https://folx.tv/uploads/x.webp) - prej se
|
||||||
|
* kljuc ni ujel, zaris se ni uporabil in kvadratne ploscice so rezale glave.
|
||||||
|
* Zato uporabimo skupno objectPositionFor, ki obe obliki poravna.
|
||||||
|
*/
|
||||||
function getObjectPosition(coverImage: string | null, focalPoints?: Record<string, { x: number; y: number }>): string {
|
function getObjectPosition(coverImage: string | null, focalPoints?: Record<string, { x: number; y: number }>): string {
|
||||||
if (!coverImage || !focalPoints) return "center 25%";
|
return objectPositionFor(coverImage, focalPoints as any);
|
||||||
const fp = focalPoints[coverImage];
|
|
||||||
if (!fp) return "center 25%";
|
|
||||||
return `${fp.x}% ${fp.y}%`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function MosaicTile({ article, focalPoints, tall = false }: { article: Article; focalPoints?: Record<string, { x: number; y: number }>; tall?: boolean }) {
|
function MosaicTile({ article, focalPoints, tall = false }: { article: Article; focalPoints?: Record<string, { x: number; y: number }>; tall?: boolean }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user