Skip to content

feat: use multiple clips for 'zoom to selection' ('z')#13

Merged
ronak-create merged 1 commit into
ronak-create:mainfrom
PlkMarudny:zoom-to-fit-selection
Jul 13, 2026
Merged

feat: use multiple clips for 'zoom to selection' ('z')#13
ronak-create merged 1 commit into
ronak-create:mainfrom
PlkMarudny:zoom-to-fit-selection

Conversation

@PlkMarudny

@PlkMarudny PlkMarudny commented Jul 13, 2026

Copy link
Copy Markdown

What does this PR do?

'Zoom to selection' invoked by a shortcut 'z' now uses multiple selected clips.
Closes #

Type of change

  • Bug fix
  • New feature (transition / preset / text anim / effect / API)
  • Docs
  • Refactor / internal

How was it verified?

  • node --check server.js && node --check app.js && node --check mcp-server.js passes
  • Opened the editor and confirmed the change in preview
  • Confirmed the change in an export (fast or realtime), if it affects rendering
  • Updated CLAUDE.md / README.md if the schema, props, or API changed

Checklist

  • No new runtime dependencies added
  • Preview and export render identically (single compositor)
  • Commits are focused and messages are descriptive

Summary by CodeRabbit

  • Bug Fixes

    • Zooming to a selection now frames the full time span of all selected clips and centers the timeline accordingly.
  • Documentation

    • Updated the keyboard shortcut help text to clarify that the Z key zooms to selected clips.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

zoomToSelection() now fits the full time span of all selected clips and centers the timeline on that range. The Help Overlay’s Z shortcut description now refers to selected clip(s).

Changes

Selection zoom behavior

Layer / File(s) Summary
Zoom across selected clips
app.js, index.html
zoomToSelection() derives the earliest start and latest end across selected clips, computes the fitting zoom, and centers the timeline on the combined range. The Z shortcut text now says “Zoom to selected clip(s).”

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: zoom to selection now uses multiple selected clips via the Z shortcut.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app.js (1)

1227-1228: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Consider reduce instead of spread for very large selections.

Math.min(...clips.map(...)) and Math.max(...clips.map(...)) spread the entire array as arguments. While unlikely to matter in practice (clip counts are typically modest), engines cap argument counts (~65k+). A reduce-based approach avoids this theoretical limit and also avoids creating an intermediate array.

♻️ Optional refactor using reduce
-  const t0 = Math.min(...clips.map((c) => c.start));
-  const t1 = Math.max(...clips.map((c) => c.start + c.duration));
+  const t0 = clips.reduce((m, c) => Math.min(m, c.start), Infinity);
+  const t1 = clips.reduce((m, c) => Math.max(m, c.start + c.duration), -Infinity);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app.js` around lines 1227 - 1228, Update the t0 and t1 calculations to use
reduce over clips instead of map followed by spread into Math.min and Math.max.
Preserve the existing minimum start and maximum end-time results while avoiding
intermediate arrays and argument-count limits.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@app.js`:
- Around line 1227-1228: Update the t0 and t1 calculations to use reduce over
clips instead of map followed by spread into Math.min and Math.max. Preserve the
existing minimum start and maximum end-time results while avoiding intermediate
arrays and argument-count limits.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce7012c0-228e-427c-9a97-1e5fb45ee6e3

📥 Commits

Reviewing files that changed from the base of the PR and between e9286c2 and b847141.

📒 Files selected for processing (2)
  • app.js
  • index.html

@ronak-create ronak-create merged commit 12ff3ff into ronak-create:main Jul 13, 2026
2 checks 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.

2 participants