Skip to content

Allow advanced padding to position video vertically#681

Open
surim0n wants to merge 1 commit into
webadderallorg:mainfrom
surim0n:codex/true-vertical-padding-position
Open

Allow advanced padding to position video vertically#681
surim0n wants to merge 1 commit into
webadderallorg:mainfrom
surim0n:codex/true-vertical-padding-position

Conversation

@surim0n

@surim0n surim0n commented Jun 15, 2026

Copy link
Copy Markdown

Summary

  • Extends advanced Top/Bottom padding to 250% while keeping linked padding on the original 0-100 range.
  • Uses the extra vertical range as positional travel so Bottom=250 can pin the screen recording to the top edge and Top=250 can pin it to the bottom edge.
  • Preserves extended advanced padding values when projects are loaded and adds focused layout/persistence tests.

Verification

  • npx vitest --run src/components/video-editor/videoPlayback/layoutUtils.test.ts src/components/video-editor/projectPersistence.test.ts
  • npx biome check src/components/video-editor/projectPersistence.ts src/components/video-editor/projectPersistence.test.ts src/components/video-editor/types.ts src/components/video-editor/videoPlayback/layoutUtils.ts src/components/video-editor/videoPlayback/layoutUtils.test.ts

Notes

  • npm run lint still fails on existing unrelated formatting/import diagnostics outside this change.

Summary by CodeRabbit

  • New Features

    • Increased the maximum advanced unlinked vertical padding (top/bottom) from 100 to 250, allowing finer control of video spacing.
  • Bug Fixes

    • Improved padding relinking behavior by clamping the computed padding values to the expected 0–100 range when switching back to linked mode.
  • Tests

    • Added/expanded Vitest coverage for project persistence and padded layout calculations, including advanced vertical padding clamping and centering behavior.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c4e7a16-c80b-41d9-b258-d1f7dadd0be8

📥 Commits

Reviewing files that changed from the base of the PR and between 8410925 and c92a255.

📒 Files selected for processing (6)
  • src/components/video-editor/SettingsPanel.tsx
  • src/components/video-editor/projectPersistence.test.ts
  • src/components/video-editor/projectPersistence.ts
  • src/components/video-editor/types.ts
  • src/components/video-editor/videoPlayback/layoutUtils.test.ts
  • src/components/video-editor/videoPlayback/layoutUtils.ts
✅ Files skipped from review due to trivial changes (1)
  • src/components/video-editor/types.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/components/video-editor/videoPlayback/layoutUtils.test.ts
  • src/components/video-editor/projectPersistence.test.ts
  • src/components/video-editor/projectPersistence.ts
  • src/components/video-editor/videoPlayback/layoutUtils.ts

📝 Walkthrough

Walkthrough

Adds a new exported constant ADVANCED_VERTICAL_PADDING_MAX = 250 to types.ts and propagates it across three sites: layoutUtils.ts uses it for extended top/bottom clamping and a revised vertical centering formula when padding is unlinked; projectPersistence.ts applies it during padding normalization; and SettingsPanel.tsx uses it as the slider maximum for unlinked top/bottom padding controls.

Changes

Advanced Vertical Padding Max

Layer / File(s) Summary
ADVANCED_VERTICAL_PADDING_MAX constant
src/components/video-editor/types.ts
Exports new numeric constant ADVANCED_VERTICAL_PADDING_MAX = 250.
Layout clamping and vertical centering
src/components/video-editor/videoPlayback/layoutUtils.ts, src/components/video-editor/videoPlayback/layoutUtils.test.ts
computePaddedLayout detects advanced (unlinked) padding, clamps top/bottom percentages to ADVANCED_VERTICAL_PADDING_MAX, and switches to a travel-plus-directional-offset formula for vertical centering. Three new tests verify advanced top/bottom pinning and linked centering behavior.
Persistence normalization
src/components/video-editor/projectPersistence.ts, src/components/video-editor/projectPersistence.test.ts
normalizeProjectEditor computes verticalMax as 100 (linked) or ADVANCED_VERTICAL_PADDING_MAX (unlinked) and applies it when clamping top/bottom; left/right remain bounded to 0–100. Two new tests cover both the unlinked extended range and the linked clamping cases.
UI slider max and relinking
src/components/video-editor/SettingsPanel.tsx
Imports ADVANCED_VERTICAL_PADDING_MAX and replaces the hardcoded 100 max on the Top and Bottom sliders in the unlinked advanced padding UI. togglePaddingLink now clamps the computed padding average to 0–100 before applying it to all four sides when relinking.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A bunny stretched the padding high, past one hundred to the sky,
Two-fifty now the vertical max — no more cramped video stacks!
The sliders slide, the layout pins, with travel math and keen new spins,
Tests confirm each edge and center, ADVANCED_VERTICAL_PADDING_MAX — splendor! 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: extending advanced padding controls to position video vertically by expanding the range to 250%.
Description check ✅ Passed The PR description is comprehensive and covers the purpose, motivation, verification steps, and notes. However, it deviates from the template structure by using custom sections instead of the template's standard sections.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@surim0n surim0n force-pushed the codex/true-vertical-padding-position branch from a51e05f to 8410925 Compare June 20, 2026 15:26
@surim0n surim0n marked this pull request as ready for review June 20, 2026 15:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/video-editor/SettingsPanel.tsx (1)

2417-2428: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Clamp relinked padding to linked-mode bounds (0–100).

Line 2417 and Line 2428 expand unlinked vertical range to 250, but the existing relink averaging can now produce linked: true values above 100. That breaks the linked padding contract and can cause confusing jumps after persistence normalization.

💡 Proposed fix (outside this selected range, in togglePaddingLink)
 const togglePaddingLink = () => {
 	const isLinked = padding.linked !== false;
 	const nextLinked = !isLinked;
 	if (nextLinked) {
 		// Compute average for relinking to avoid sudden shifts
-		const avg = Math.round(
+		const avg = Math.min(
+			100,
+			Math.max(
+				0,
+				Math.round(
 				(padding.top + padding.bottom + padding.left + padding.right) / 4,
-			);
+				),
+			),
+		);
 		onPaddingChange?.({
 			top: avg,
 			bottom: avg,
 			left: avg,
 			right: avg,
 			linked: true,
 		});
🤖 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 `@src/components/video-editor/SettingsPanel.tsx` around lines 2417 - 2428, The
vertical padding range is expanded to 250 in unlinked mode (as shown by
max={ADVANCED_VERTICAL_PADDING_MAX} in the SliderControl components for top and
bottom padding), but when padding is relinked, the averaging logic in the
togglePaddingLink function can produce values above 100 which violates the
linked padding contract that requires bounds of 0-100. Modify the
togglePaddingLink function to clamp the newly calculated linked padding values
to the 0-100 range after averaging the unlinked values to prevent values
exceeding 100 from being set on the linked state.
🤖 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.

Outside diff comments:
In `@src/components/video-editor/SettingsPanel.tsx`:
- Around line 2417-2428: The vertical padding range is expanded to 250 in
unlinked mode (as shown by max={ADVANCED_VERTICAL_PADDING_MAX} in the
SliderControl components for top and bottom padding), but when padding is
relinked, the averaging logic in the togglePaddingLink function can produce
values above 100 which violates the linked padding contract that requires bounds
of 0-100. Modify the togglePaddingLink function to clamp the newly calculated
linked padding values to the 0-100 range after averaging the unlinked values to
prevent values exceeding 100 from being set on the linked state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ddd2f4e-0aab-4b86-ac6e-15ea18f64cfd

📥 Commits

Reviewing files that changed from the base of the PR and between 952d63d and 8410925.

📒 Files selected for processing (6)
  • src/components/video-editor/SettingsPanel.tsx
  • src/components/video-editor/projectPersistence.test.ts
  • src/components/video-editor/projectPersistence.ts
  • src/components/video-editor/types.ts
  • src/components/video-editor/videoPlayback/layoutUtils.test.ts
  • src/components/video-editor/videoPlayback/layoutUtils.ts

@surim0n surim0n force-pushed the codex/true-vertical-padding-position branch from 8410925 to c92a255 Compare June 20, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant