mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-09 03:16:38 +00:00
fix(studio): adapt sidebar thumbnail container to composition aspect ratio (#728)
Portrait compositions (1080x1920) rendered pillarboxed inside a fixed 80x45px landscape container, wasting space with black bars on both sides. The thumbnail container now derives its dimensions from the composition's stage size: landscape gets 80px wide, portrait gets 45px tall. The preview scale calculation uses matching card dimensions so the iframe fills the container without letterboxing. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7b157dbc86
commit
a94ca4f5d3
@@ -55,9 +55,12 @@ function CompCard({
|
||||
const name = comp.replace(/^compositions\//, "").replace(/\.html$/, "");
|
||||
const thumbnailUrl = `/api/projects/${projectId}/thumbnail/${comp}?t=2`;
|
||||
const previewUrl = `/api/projects/${projectId}/preview/comp/${comp}`;
|
||||
const isPortrait = stageSize.height > stageSize.width;
|
||||
const cardWidth = isPortrait ? Math.round((45 * stageSize.width) / stageSize.height) : 80;
|
||||
const cardHeight = isPortrait ? 45 : Math.round((80 * stageSize.height) / stageSize.width);
|
||||
const previewScale = resolveCompositionPreviewScale({
|
||||
cardWidth: 80,
|
||||
cardHeight: 45,
|
||||
cardWidth,
|
||||
cardHeight,
|
||||
stageWidth: stageSize.width,
|
||||
stageHeight: stageSize.height,
|
||||
});
|
||||
@@ -73,7 +76,10 @@ function CompCard({
|
||||
: "border-l-2 border-transparent hover:bg-neutral-800/50"
|
||||
}`}
|
||||
>
|
||||
<div className="w-20 h-[45px] rounded overflow-hidden bg-neutral-900 flex-shrink-0 relative">
|
||||
<div
|
||||
className="rounded overflow-hidden bg-neutral-900 flex-shrink-0 relative"
|
||||
style={{ width: cardWidth, height: cardHeight }}
|
||||
>
|
||||
{/* Live iframe preview on hover */}
|
||||
{hovered && (
|
||||
<iframe
|
||||
|
||||
Reference in New Issue
Block a user