Skip to content

Commit 43f08ed

Browse files
committed
docs(skills): add-media recipe matches Studio's full-frame geometry and z-index
1 parent 0f7fb27 commit 43f08ed

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎scripts/creator-editing-recipes.test.mjs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,17 @@ test("the Studio skill's safe boxes equal the preview's", async () => {
7777
test("the add-media recipe matches Studio's own drop defaults", async () => {
7878
const helpers = await read("packages/studio/src/utils/studioHelpers.ts");
7979
const defaults = helpers.match(/DEFAULT_TIMELINE_ASSET_DURATION[^=]*=\s*\{([^}]*)\}/)?.[1] ?? "";
80-
const secs = (kind) => defaults.match(new RegExp(`${kind}:\\s*(\\d+)`))?.[1];
80+
const secs = (kind) => defaults.match(new RegExp(`${kind}:\\s*(\\d+(?:\\.\\d+)?)`))?.[1];
8181
const section = (await read(OWNER)).split("## Add media")[1]?.split("\n## ")[0] ?? "";
8282
assert.ok(secs("image"), "could not read Studio's image default");
8383
assert.match(section, new RegExp(`Image: \`data-duration="${secs("image")}"\``));
8484
assert.match(section, new RegExp(`\`${secs("video")}\` only when the length cannot be read`));
8585
const image = section.match(/<img[\s\S]*?\/>/)?.[0] ?? "";
8686
assert.match(image, new RegExp(`data-duration="${secs("image")}"`));
87+
const dropOps = await read("packages/studio/src/hooks/useTimelineAssetDropOps.ts");
88+
assert.match(dropOps, /fitTimelineAssetGeometry\(\s*null,/, "Studio centres by natural size now; update the doc");
89+
assert.match(section, /fill the whole frame/);
90+
assert.match(image, /left: 0px; top: 0px; width: 1920px; height: 1080px/);
8791
const drop = await read("packages/studio/src/utils/timelineAssetDrop.ts");
8892
for (const attr of ["class=\"clip\"", "data-start", "data-duration", "data-track-index"]) {
8993
assert.ok(drop.includes(attr), `Studio no longer writes ${attr}`);

‎skills-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"files": 11
3535
},
3636
"hyperframes-core": {
37-
"hash": "5944015f0f48d820",
37+
"hash": "6a1e879292035eed",
3838
"files": 11
3939
},
4040
"hyperframes-creative": {

‎skills/hyperframes-core/references/creator-editing-recipes.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,12 @@ Write exactly what Studio writes when a person drops a file on the timeline, so
423423

424424
- **Image: `data-duration="3"`.** A still has no length of its own, so it gets 3 seconds. Without a `data-duration` it never ends and stays on screen for the rest of the composition.
425425
- **Video and audio: the file's own length** in seconds (`ffprobe -v error -show_entries format=duration -of csv=p=0 file`); `5` only when the length cannot be read. Studio rounds to hundredths.
426-
- **Start: the playhead or the requested time, never a silent `0`.** Studio's asset-panel Add uses the playhead time on track `0`; a drop uses the drop point. Several files dropped together run end to end from the first start.
426+
- **Start: the playhead or the requested time, never a silent `0`.** Studio's asset-panel Add uses the playhead time on track `0`; a drop uses the drop point.
427427
- Give every clip `id`, `class="clip"`, `data-start`, `data-duration` and `data-track-index`. Video is `muted playsinline`; audio carries `data-volume="1"`.
428-
- Then make sure the root composition's `data-duration` is at least `data-start + data-duration`; Studio extends it, an agent must too, or the clip lies past the end and never plays.
429-
- Images and video sit absolutely positioned, `object-fit: contain`, centred at their natural size (scaled down to fit): `left = (frameWidth - width) / 2`, `top = (frameHeight - height) / 2`. Below, an 800x600 still in a 1920x1080 frame.
428+
- Then make sure the root composition's `data-duration` is at least `data-start + data-duration`: Studio raises a declared root duration to cover the new clip, so an agent must too, or the clip lies past the end and never plays.
429+
- **Images and video fill the whole frame**: absolutely positioned at `left: 0; top: 0`, `width` and `height` equal to the composition's `data-width` and `data-height`, `object-fit: contain`. Studio does not know a dropped file's natural size, so it does not centre a smaller one.
430+
- `z-index` is the number of top-level clips already in that file plus one (at least `1`); later clips stack above earlier ones.
431+
- Several files dropped together share the drop's track and run end to end.
430432

431433
```html
432434
<img
@@ -436,7 +438,7 @@ Write exactly what Studio writes when a person drops a file on the timeline, so
436438
data-start="4"
437439
data-duration="3"
438440
data-track-index="1"
439-
style="position: absolute; left: 560px; top: 240px; width: 800px; height: 600px; object-fit: contain; z-index: 2"
441+
style="position: absolute; left: 0px; top: 0px; width: 1920px; height: 1080px; object-fit: contain; z-index: 2"
440442
/>
441443
```
442444

0 commit comments

Comments
 (0)