From fc7e9c38a0bf46e717f8b12800e8b32905044635 Mon Sep 17 00:00:00 2001 From: folx bot Date: Sat, 29 Aug 2026 21:36:51 +0200 Subject: [PATCH] Naslovnica: zaris obraza se zdaj ujame tudi pri absolutnih URL-jih (kvadratne ploscice ne rezejo glav) --- client/src/pages/home.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 568fcc5..97b0b70 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -1,5 +1,6 @@ import { useQuery } from "@tanstack/react-query"; import { artistGroup } from "@/lib/artists"; +import { objectPositionFor } from "@/lib/focal"; import { Link } from "wouter"; import { type Article } from "@shared/schema"; 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 { - if (!coverImage || !focalPoints) return "center 25%"; - const fp = focalPoints[coverImage]; - if (!fp) return "center 25%"; - return `${fp.x}% ${fp.y}%`; + return objectPositionFor(coverImage, focalPoints as any); } function MosaicTile({ article, focalPoints, tall = false }: { article: Article; focalPoints?: Record; tall?: boolean }) {