@@ -36,6 +36,8 @@ interface NLEPreviewProps {
3636 onStageRef ?: ( ref : React . RefObject < HTMLDivElement | null > ) => void ;
3737 /** Reports the authored composition size measured from the loaded preview. */
3838 onCompositionSizeChange ?: ( size : PreviewCompositionSize | null ) => void ;
39+ /** Draws the picture edge to edge in this box, without Studio's inset band. */
40+ fillBox ?: boolean ;
3941}
4042
4143export function getPreviewPlayerKey ( {
@@ -50,7 +52,7 @@ export function getPreviewPlayerKey({
5052
5153const ZOOM_HUD_TIMEOUT_MS = 1200 ;
5254const ZOOM_SETTLE_MS = 200 ;
53- const PREVIEW_STAGE_INSET_PX = 16 ;
55+ const PREVIEW_STAGE_INSET_PX = 8 ;
5456
5557// clip-path as well as visibility: the player's loading overlay sets its own
5658// visibility:visible and would otherwise paint over the live frame.
@@ -87,9 +89,10 @@ export function resolvePreviewStageSize(
8789 compositionSize : PreviewCompositionSize | null ,
8890 portrait : boolean | undefined ,
8991 gutterPx = 0 ,
92+ insetPx = PREVIEW_STAGE_INSET_PX ,
9093) : { width : number ; height : number } {
91- const availableWidth = Math . max ( 0 , viewportWidth - PREVIEW_STAGE_INSET_PX - 2 * gutterPx ) ;
92- const availableHeight = Math . max ( 0 , viewportHeight - PREVIEW_STAGE_INSET_PX - 2 * gutterPx ) ;
94+ const availableWidth = Math . max ( 0 , viewportWidth - 2 * ( insetPx + gutterPx ) ) ;
95+ const availableHeight = Math . max ( 0 , viewportHeight - 2 * ( insetPx + gutterPx ) ) ;
9396 const aspectRatio =
9497 compositionSize && compositionSize . width > 0 && compositionSize . height > 0
9598 ? compositionSize . width / compositionSize . height
@@ -130,6 +133,7 @@ export const NLEPreview = memo(function NLEPreview({
130133 suppressLoadingOverlay,
131134 onStageRef,
132135 onCompositionSizeChange,
136+ fillBox,
133137} : NLEPreviewProps ) {
134138 const activeKey = getPreviewPlayerKey ( { projectId, directUrl } ) ;
135139 const viewportRef = useRef < HTMLDivElement > ( null ) ;
@@ -151,6 +155,7 @@ export const NLEPreview = memo(function NLEPreview({
151155 const reportPreviewFirstFrame = usePreviewFirstFrameTelemetry ( previewSlots ) ;
152156 const [ compositionSize , setCompositionSize ] = useState < PreviewCompositionSize | null > ( null ) ;
153157 const gutterPx = usePreviewGuidesStore ( ( s ) => ( s . rulerVisible ? RULER_GUTTER_PX : 0 ) ) ;
158+ const insetPx = fillBox ? 0 : PREVIEW_STAGE_INSET_PX ;
154159 const [ stageSize , setStageSize ] = useState ( ( ) => resolvePreviewStageSize ( 0 , 0 , null , portrait ) ) ;
155160
156161 const zoomRef = useRef < PreviewZoomState > ( loadInitialZoom ( ) ) ;
@@ -181,15 +186,22 @@ export const NLEPreview = memo(function NLEPreview({
181186 const updateStageSize = ( ) => {
182187 const rect = viewport . getBoundingClientRect ( ) ;
183188 setStageSize (
184- resolvePreviewStageSize ( rect . width , rect . height , compositionSize , portrait , gutterPx ) ,
189+ resolvePreviewStageSize (
190+ rect . width ,
191+ rect . height ,
192+ compositionSize ,
193+ portrait ,
194+ gutterPx ,
195+ insetPx ,
196+ ) ,
185197 ) ;
186198 } ;
187199
188200 updateStageSize ( ) ;
189201 const observer = new ResizeObserver ( updateStageSize ) ;
190202 observer . observe ( viewport ) ;
191203 return ( ) => observer . disconnect ( ) ;
192- } , [ compositionSize , portrait , gutterPx ] ) ;
204+ } , [ compositionSize , portrait , gutterPx , insetPx ] ) ;
193205
194206 const onCompositionSizeChangeRef = useRef ( onCompositionSizeChange ) ;
195207 onCompositionSizeChangeRef . current = onCompositionSizeChange ;
@@ -467,11 +479,14 @@ export const NLEPreview = memo(function NLEPreview({
467479 < div className = "flex flex-col h-full min-h-0" >
468480 < div
469481 ref = { viewportRef }
470- className = "relative flex-1 flex items-center justify-center p-2 overflow-hidden min-h-0 outline-hidden focus:ring-1 focus:ring-studio-accent/40 bg-[var(--studio-preview-bg,var(--color-neutral-950))]"
482+ className = "relative flex-1 flex items-center justify-center overflow-hidden min-h-0 outline-hidden focus:ring-1 focus:ring-studio-accent/40 bg-[var(--studio-preview-bg,var(--color-neutral-950))]"
471483 tabIndex = { 0 }
472484 aria-label = "Composition preview"
473485 >
474- < div className = "absolute inset-2 flex items-center justify-center pointer-events-none" >
486+ < div
487+ className = "absolute flex items-center justify-center pointer-events-none"
488+ style = { { inset : insetPx } }
489+ >
475490 < div
476491 ref = { stageRef }
477492 className = "relative shrink-0 pointer-events-auto"
0 commit comments