|
1 | 1 | import { memo, useState, useRef, useEffect, useId } from "react"; |
| 2 | +import { CANVAS_DIMENSIONS } from "@hyperframes/parsers"; |
2 | 3 | import { RenderQueueItem } from "./RenderQueueItem"; |
3 | 4 | import { Button } from "../ui/Button"; |
4 | 5 | import type { RenderJob, ResolutionPreset } from "./useRenderQueue"; |
@@ -53,17 +54,6 @@ const SCALE_LABEL: Record<RenderScale, string> = { |
53 | 54 | "4k": "4K", |
54 | 55 | }; |
55 | 56 |
|
56 | | -// Mirrors `CANVAS_DIMENSIONS` in @hyperframes/core. Studio can't import from |
57 | | -// the core barrel (it transitively pulls in node:fs) and the values are stable. |
58 | | -const CANVAS_DIMENSIONS: Record<ResolutionPreset, CompositionDimensions> = { |
59 | | - landscape: { width: 1920, height: 1080 }, |
60 | | - portrait: { width: 1080, height: 1920 }, |
61 | | - "landscape-4k": { width: 3840, height: 2160 }, |
62 | | - "portrait-4k": { width: 2160, height: 3840 }, |
63 | | - square: { width: 1080, height: 1080 }, |
64 | | - "square-4k": { width: 2160, height: 2160 }, |
65 | | -}; |
66 | | - |
67 | 57 | type CompAspect = "landscape" | "portrait" | "square"; |
68 | 58 |
|
69 | 59 | function compAspect(dims: CompositionDimensions | null | undefined): CompAspect { |
@@ -254,7 +244,7 @@ function FormatExportButton({ |
254 | 244 | const persisted = getPersistedRenderSettings(); |
255 | 245 | const [format, setFormat] = useState<"mp4" | "webm" | "mov">(persisted.format); |
256 | 246 | const [quality, setQuality] = useState<"draft" | "standard" | "high">(persisted.quality); |
257 | | - const [resolution, setResolution] = useState<ResolutionPreset | "auto">("auto"); |
| 247 | + const [resolution, setResolution] = useState<RenderScale>("auto"); |
258 | 248 | const [fps, setFps] = useState<24 | 30 | 60>(persisted.fps); |
259 | 249 |
|
260 | 250 | // MOV (ProRes) is a fixed-quality codec — quality selector has no effect. |
@@ -290,7 +280,7 @@ function FormatExportButton({ |
290 | 280 | <span className="text-[10px] text-panel-text-4">Resolution</span> |
291 | 281 | <select |
292 | 282 | value={resolution} |
293 | | - onChange={(e) => setResolution(e.target.value as ResolutionPreset | "auto")} |
| 283 | + onChange={(e) => setResolution(e.target.value as RenderScale)} |
294 | 284 | disabled={isRendering} |
295 | 285 | className={selectCls} |
296 | 286 | > |
@@ -352,8 +342,9 @@ function FormatExportButton({ |
352 | 342 | // loading already disables the button; this guard also stops a |
353 | 343 | // double-click in the same frame from enqueueing two renders. |
354 | 344 | if (isRendering) return; |
355 | | - trackStudioEvent("render_start", { format, quality, resolution, fps }); |
356 | | - void onStartRender(format, quality, resolution, fps); |
| 345 | + const outputResolution = resolveResolution(resolution, compositionDimensions); |
| 346 | + trackStudioEvent("render_start", { format, quality, resolution: outputResolution, fps }); |
| 347 | + void onStartRender(format, quality, outputResolution, fps); |
357 | 348 | }} |
358 | 349 | className="w-full text-[11px] font-semibold" |
359 | 350 | > |
|
0 commit comments