Skip to content

A new layer takes its picture's own shape - #337

Draft
kixelated wants to merge 16 commits into
mainfrom
quest/m0/ux/source-size
Draft

kixelated wants to merge 16 commits into
mainfrom
quest/m0/ux/source-size

Conversation

@kixelated

@kixelated kixelated commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Claims quest/m0/ux/source-size.md.

Problem

A layer added from a device or From the show can start at the canvas aspect ratio. Cameras and sources selected through the system picker may only report their dimensions when a frame arrives.

Approach

Use the source aspect ratio for click and drag placement. A source with unknown dimensions keeps a provisional rectangle. The first frame fits each pending layer inside its provisional rectangle. For an untouched click addition, Studio checks coverage of the fitted rectangle and uses an inset in front if the picture would be obscured. The normal undo and save paths record the result.

Impact

  • Add keeps the whole picture at its source aspect ratio. A layer you move can still fit around its new center. Resizing or cropping it cancels the pending fit.
  • The inspector stays on the selected layer when its first picture moves it into an inset. Idle sources leave room for new pictures until they draw.
  • Scene files and the wire format are compatible with existing versions.

Decisions

  • Maintainer: Keep pending sizing in memory only. A show reopened before the first frame keeps its saved rectangle until manually resized. Decision
  • Agent: Use the provisional rectangle as the fit bounds. Start from each format's placement and preserve movements already made to the layer.
  • Agent: Place a layer as an inset when existing layers would cover its fitted rectangle.
  • Agent: Preserve pending fits when undo can be redone. Delay an automatic geometry edit while there are redo entries.
  • Maintainer: Decide inset placement from the first frame's fitted rectangle for untouched click additions. Keep a full-size camera behind a centered logo and put a square window in front when it would be covered. Decision
  • Agent: Apply first-frame fits from front to back in one undoable edit.
  • Maintainer: Preserve the selection by following its layer ID to the new index when the first picture moves a layer into an inset. Decision
  • Maintainer: Ignore idle placeholders when calculating inset coverage. A layer counts once it has a drawable picture. Decision
  • Agent: Store the item ID in the UI's layer pick, reuse it in the palette, and stop a drag when its cached index changes.
  • Agent: Use the compositor's current picture for capture-backed coverage. Colors, nested scenes, and the program can draw without a capture.

Waiting

  • Maintainer: After a layer is dragged onto an occupied slot, should Studio select the dragged layer in its new slot? Both slot-drop handlers currently select the displaced layer's ID. The inspector and Delete then act on that layer. Quest review finding
    • Keep the dragged layer selected (Recommended) - select its ID at the destination in both slot-drop paths and test that Delete acts on it.
    • Accept the current selection - the displaced layer stays selected after a swap.
    • /quest-advice - reconsider how slot swaps and selection should interact.
  • Maintainer: Should Add recheck coverage when a backdrop that was already loading draws its first picture? A listed display can be placed full-size behind a saved image that is still loading. The image can then hide the display. Quest review finding
    • Recheck when the backdrop becomes drawable (Recommended) - apply the usual coverage test only to untouched additions, only when an existing source already starting at Add starts to draw. Idle Replay still leaves room for new pictures.
    • Accept the current placement - keep the original placement if the backdrop later obscures the addition.
    • /quest-advice - reconsider whether first-frame placement should depend on existing sources finishing startup.
  • moq-dev/moq: Fix padded GNOME window captures and land the capture-side regression test. Pin the fix in Studio, then repeat the GNOME window test and check that the layer fits the actual content without the right and bottom bands.

Alternatives

Saving pending sizing with the layer would let it resume across reopen, at the cost of changing the scene format and requiring compatible readers.

Follow-ups

Caused by

  • Studio PR 262 - one-click Add placed the first layer at the canvas aspect ratio (found by person).

Validation

  • GNOME Shell 51.1, real window picker on a headless 1280×800 Wayland session. The selected 600×300 GTK window arrived from PipeWire as a 1280×800 buffer. The opaque pixels covered the top-left 600×300, with zero pixels to the right and below, before Studio.

  • Rendered the Add, From the show, square inset, and dual-output placement views on lavapipe. The first-frame tests cover a centered logo over a full-size camera, a square picked window in front of an opaque 4:3 layer, moving a layer before its first frame, undo and redo, role fill, idle Replay, and reopen.

  • just ci passed on 1dcab1f. 594 Rust tests and 11 JavaScript tests passed. The 20 focused placement and screenshot checks also passed.

  • just ci passed on f004551, including 601 Rust tests. CI ran inside the repository's Nix shell with Codex's nested-shell startup hook unset so Bun could find its workspace tools.

  • The new Studio regression tests reproduced both findings before the fixes and passed afterward. The selected camera is still the target of Delete after its first-frame move. Idle Replay leaves room for a listed display and for a window that reports its size on its first frame.

  • The three Add WebPs match the existing images byte for byte. The focused dual-output shots passed. The full just shots run timed out in four cases, including the three dual-output views verified in the focused run.

  • Quest review round 5 scored 8/10 and confirmed both earlier findings are fixed. It stopped at next decide on slot-swap selection and coverage when an existing backdrop finishes loading.

Shots

Mock-up Studio
Add mock-up Add

From the show · Square scene placed as an inset

Models

Size: S
Implementer: Codex, gpt-6.2-sol, high
Implementer: Codex, gpt-6.2-sol, high (iterate, S)
Implementer: Codex, gpt-6.2-sol, high (iterate, S)
Implementer: Codex, gpt-6.2-sol, high (iterate, S)

(Written by GPT-6.2 Sol with high)

Quest-Claim: 7e343f7226136fa2
@kixelated

Copy link
Copy Markdown
Contributor Author

Maintainer decision (2026-12-04, /quest-run):

  • Pending one-time sizing across a save and reopen before the first frame: ✅ keep it in memory only. No scene-format change; a reopen before the first frame keeps the provisional rectangle until a manual resize (rejected: persisting it with the layer, /quest-advice).

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Contributor Author

Implemented the maintainer decision in the current head. Pending fits live in Studio's runtime state. The first-frame test verifies that reopening a show before the picture arrives preserves its saved rectangle.

(Written by GPT-6.2 Sol with high)

@kixelated

Copy link
Copy Markdown
Contributor Author

Maintainer decision (2026-12-04, /quest-run):

  • Review round 3's placement finding: ✅ decide inset placement from the first frame's fitted rectangle, only for click-added layers the user hasn't touched. Test both that a camera stays full-size behind a centered logo and that a square picked window stays visible when a larger layer would cover it (rejected: accepting it, /quest-advice).

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Contributor Author

The maintainer's placement decision is implemented in the current head. The first fitted rectangle keeps a camera full-size behind a centered logo and moves a covered square window into a foreground inset. A layer moved by the streamer keeps its chosen position.

(Written by GPT-6.2 Sol with high)

@kixelated

Copy link
Copy Markdown
Contributor Author

Maintainer decision (2026-12-04, /quest-run):

  • Selection when first-frame placement moves a layer into an inset: ✅ preserve it by following the selected layer's ID to its new index (rejected: accepting the reset, /quest-advice).
  • An idle source's placeholder in inset coverage: ✅ ignore it; a layer counts once it has a drawable picture (rejected: letting pending layers reserve space, /quest-advice).

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Contributor Author

The maintainer’s two placement decisions are implemented in the current head. The selection follows its layer ID after the first-frame reorder. An idle Replay leaves room for a new picture. Both Studio regression tests and just ci passed.

(Written by GPT-6.2 Sol with high)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant