Skip to content

Add smart-fit as default photo fit mode#55

Merged
cbaucom merged 2 commits into
mainfrom
feat/smart-fit
Jun 23, 2026
Merged

Add smart-fit as default photo fit mode#55
cbaucom merged 2 commits into
mainfrom
feat/smart-fit

Conversation

@cbaucom

@cbaucom cbaucom commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds smart-fit as the default global fit mode (themes included). At plan time it resolves per slide from media vs canvas aspect ratio: orientation/shape mismatches → blur-fill, compatible orientations → cover, unknown dimensions → contain.
  • Extracts intrinsic width/height when media is loaded (image bitmap + Mediabunny video track) so the planner can make fit decisions.
  • Passes project aspectRatio into plan(); RenderPlan entries still carry only concrete fit modes (cover | contain | blur-fill). Per-slide overrides unchanged.

Code review

Score: 4/5 — APPROVE

Blocking findings

None.

Non-blocking findings

  • media-loader.ts — video files open two separate Mediabunny Input instances (duration + dimensions). Could merge into one parse in a follow-up.
  • planner.tsaspectRatio is a 7th positional parameter; consider an options bag if more plan inputs accumulate.
  • No unit test for mediaMetadata width/height fallback path (slide lacks dims, metadata has them).
  • createImageBitmap is not stubbed in import tests; dimension extraction silently no-ops on invalid blobs in test env (acceptable for now).

Strengths

  • Fit decisions stay in pure modules (smartFit.ts + planner); composition unchanged.
  • Deterministic resolution from slide dimensions + canvas aspect ratio.
  • Good table-driven coverage in smartFit.test.ts plus planner integration tests for the key cases.
  • Existing projects with saved fitMode: 'cover' are unaffected.

Test plan

  • pnpm test
  • pnpm lint
  • pnpm build
  • Manual: 9:16 canvas + 16:9 photo → full image visible with blur-fill (Smart fit global)
  • Manual: switch global to Cover (crop) → photo crops again
  • Manual: refresh folder after upgrade so slides pick up dimensions
  • Manual: per-slide fit override still wins over global smart-fit

Made with Cursor

cbaucom and others added 2 commits June 22, 2026 16:42
Resolve fit per slide from media vs canvas aspect ratio so mismatched orientations letterbox instead of crop, while keeping cover for compatible pairs and manual overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use object-contain in timeline blocks and per-slide aspect-ratio on filmstrip cards so portrait and landscape media preview without forced 16:9 cropping.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cbaucom
cbaucom merged commit 6781b59 into main Jun 23, 2026
1 check passed
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