Open source CapCut alternative.
TypeScript
fix(site): size type from compare_to_source's letterboxed read, not the fill
David Le87aaba79ddee
diff --git a/site/src/cut/components/AiPanel.tools.ts b/site/src/cut/components/AiPanel.tools.tsindex 1b8d9aac..93230a8d 100644--- a/site/src/cut/components/AiPanel.tools.ts+++ b/site/src/cut/components/AiPanel.tools.ts@@ -233,7 +233,7 @@ export const AI_PANEL_TOOLS = [type: "string",enum: ["letterbox", "fill"],description:- "How a source of another shape sits in the cut's frame to be scored. letterbox (the default): whole, over the background, the way a clip of that shape sits on the timeline. fill: scaled to cover the frame and centre-cropped, for a copy that fills its own frame edge to edge in another shape — what the crop cuts off is not checked, and type and shapes read at the fill's scale",+ "How a source of another shape sits in the cut's frame to be scored. letterbox (the default): whole, over the background, the way a clip of that shape sits on the timeline. fill: scaled to cover the frame and centre-cropped, to check full-bleed colour edge to edge in another shape — what the crop cuts off is not checked, and type and shapes come out blown up with the crop, so size them from letterbox",},picture: pictureArg,},diff --git a/site/src/cut/lib/compareToSource.test.ts b/site/src/cut/lib/compareToSource.test.tsindex a6e9384f..68711b2f 100644--- a/site/src/cut/lib/compareToSource.test.ts+++ b/site/src/cut/lib/compareToSource.test.ts@@ -247,11 +247,15 @@ test("a source of another shape fills the cut's frame when asked, centre-croppeduseEditor.setState({ aspect: "16:9" });const boxed = (await runAiTool("compare_to_source", { asset_id: "ref", times: [1] })) as { frame?: string };expect(boxed.frame).toContain('fit "fill"');+ // The fill crops a tall source into a wide frame and blows its type up+ // with it, so type is sized from the letterboxed read.+ expect(boxed.frame).toContain("size type and shapes from this read");draws.length = 0;const out = (await runAiTool("compare_to_source", { asset_id: "ref", times: [1], fit: "fill" })) as { frame?: string };expect(out.frame).toContain("fill");expect(out.frame).not.toContain("letterboxed");+ expect(out.frame).toContain('size type and shapes from fit "letterbox"');// The source covers the surface it is scored on: as wide as it, taller,// and centred, so its top and bottom run off the edges.const placed = draws.filter((d) => d.h > d.into.h);diff --git a/site/src/cut/lib/sourceCompare.ts b/site/src/cut/lib/sourceCompare.tsindex 4394cc3b..7e47d777 100644--- a/site/src/cut/lib/sourceCompare.ts+++ b/site/src/cut/lib/sourceCompare.ts@@ -199,13 +199,13 @@ function frameNote(if (fit === "fill") {return (`${shapes}, so scores read the source scaled to fill the cut's frame, centre-cropped. ` +- "What the crop cuts off is not checked, and type and shapes read at the fill's scale; fit \"letterbox\" reads the whole source."+ "What the crop cuts off is not checked, and type and shapes read here blown up with the crop: check colour fields with this, but size type and shapes from fit \"letterbox\", which keeps them in proportion to the frame.");}return (`${shapes}, so scores read the source letterboxed into the cut's frame over its background. ` +- "Bars the cut does not have count as difference; set_aspect to the source's shape when the copy should match it, " +- 'or pass fit "fill" when the copy fills its own frame edge to edge.'+ "Bars the cut does not have count as difference; set_aspect to the source's shape when the copy should match it. " ++ 'In another shape, size type and shapes from this read, and pass fit "fill" only to check full-bleed colour edge to edge.');}