Skip to content

fix(editor): patch HUD passthrough and timeline clip drag#616

Merged
meiiie merged 3 commits into
mainfrom
fix/hud-timeline-patch-1.3.3
May 28, 2026
Merged

fix(editor): patch HUD passthrough and timeline clip drag#616
meiiie merged 3 commits into
mainfrom
fix/hud-timeline-patch-1.3.3

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 28, 2026

Summary

  • Restore HUD clickability after hiding/showing the webcam preview by reasserting interactive mouse state with a short grace window.
  • Let clip drags extend the timeline when there is no room at the end.
  • Improve clip reorder intent by snapping preview/drop positions when a dragged clip crosses adjacent clips, and enable gentler timeline autoscroll while dragging near edges.

Root cause

The HUD could remain in click-through mode after webcam preview restore because the interactive mouse state was reasserted too briefly. Timeline clip dragging was also bounded to the current timeline duration and only resolved overlap at drop time, which made clips hard to reorder when there was no visible space.

Validation

  • npx vitest run src\components\video-editor\timeline\dnd\engine.test.ts
  • npx biome check electron\main.ts electron\windows.ts src\components\launch\hooks\useLaunchHudInteractionState.ts src\components\video-editor\timeline\components\wrapper\TimelineWrapper.tsx src\components\video-editor\timeline\dnd\engine.ts src\components\video-editor\timeline\dnd\engine.test.ts
  • npx tsc --noEmit
  • npm run smoke:electron-main-cjs
  • Local dev smoke after restart

Summary by CodeRabbit

  • Improvements

    • More reliable HUD mouse interaction timing and reassertion for smoother mouse passthrough behavior.
    • Centralized HUD interaction tracking to better detect interactive mouse activity.
    • Improved timeline drag preview visuals and position accuracy during dragging.
    • Enabled auto-scrolling in the timeline for smoother positioning.
    • Refined clip clamping and neighbor-aware positioning when dragging/resizing clips.
  • Tests

    • Expanded timeline drag/resize tests covering overlap, insertion, and timeline-extension scenarios.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

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: de5027cc-edb1-4310-9619-da4987326805

📥 Commits

Reviewing files that changed from the base of the PR and between 2464364 and 5d76193.

📒 Files selected for processing (1)
  • src/components/video-editor/timeline/components/wrapper/TimelineWrapper.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/video-editor/timeline/components/wrapper/TimelineWrapper.tsx

📝 Walkthrough

Walkthrough

HUD passthrough reassert timing is parameterized and HUD interaction detection is centralized; timeline DnD adds clip-row-aware clamping and insertion resolution, TimelineWrapper uses resolved preview spans during drag-move, autoScroll is enabled, and tests are expanded.

Changes

HUD Mouse Interaction Timing & Passthrough

Layer / File(s) Summary
HUD passthrough parameter signature and timing
electron/windows.ts, electron/main.ts
reassertHudOverlayMousePassthrough now accepts optional interactiveGraceMs (default) and the Win32 show-from-tray path passes 1200 ms.
HUD mouse interaction state centralization
src/components/launch/hooks/useLaunchHudInteractionState.ts
Hook adds lastInteractiveReassertAtRef, a rate-limited setHudMouseInteractive, and global mouseover/mousemove handlers to detect interactive DOM targets and coordinate the 300ms ignore logic.

Timeline Drag & Drop Engine Clip-Row Clamping

Layer / File(s) Summary
Clip-row drag clamping helpers and core logic
src/components/video-editor/timeline/dnd/engine.ts
Adds helpers to compute clip-aware effective totals, overlap detection, and insertion-span resolution. clampDraggedSpanToNeighbours and resolveDragEnd use clip-specific effective totals when dragging on the clip row.
Engine test coverage for drag/resize scenarios
src/components/video-editor/timeline/dnd/engine.test.ts
Adds hasBaseOverlap and expanded tests for final-clip extension, middle-clip-after-final behavior, overlap-as-reorder intent, and bounding for non-clip drags; retains existing resize/overlap assertions.
Timeline wrapper drag preview resolution and autoScroll
src/components/video-editor/timeline/components/wrapper/TimelineWrapper.tsx
resolveDragPreviewSpan uses resolveDragEnd to produce a corrected preview span for tooltips and live-preview callbacks; TimelineContext autoScroll is enabled and configured.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Checked

Poem

🐰 A gentle grace ticks, the HUD stays kind,
Clips hop and settle where neighbors align,
Previews now whisper the end that will be,
AutoScroll nudges the timeline with glee,
Hops, hops, hooray — the rabbit approves the design!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% 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 changes: HUD passthrough fixes and timeline clip drag improvements, matching the core objectives.
Description check ✅ Passed The description covers key sections: Summary of changes, Root cause analysis, and Validation steps. However, it is missing several template sections like Type of Change, Related Issue(s), Screenshots/Video, Testing Guide, and Checklist.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hud-timeline-patch-1.3.3

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/components/video-editor/timeline/components/wrapper/TimelineWrapper.tsx`:
- Around line 129-150: resolveDragPreviewSpan currently falls back to the raw
span when resolveDragEnd returns null, causing previews that will be rejected on
drop; change resolveDragPreviewSpan to return null when resolveDragEnd returns
null (i.e., update its return type to Span | null and return null instead of
span), update any callers to handle a nullable preview (skip rendering the
preview when null), and apply the same change to the other similar handler (the
function around lines 161-173 that also calls resolveDragEnd) so both preview
paths avoid showing invalid placements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 632966e5-04e3-4896-b8bd-3c6fdd2cf27d

📥 Commits

Reviewing files that changed from the base of the PR and between 4a1e50e and 2464364.

📒 Files selected for processing (6)
  • electron/main.ts
  • electron/windows.ts
  • src/components/launch/hooks/useLaunchHudInteractionState.ts
  • src/components/video-editor/timeline/components/wrapper/TimelineWrapper.tsx
  • src/components/video-editor/timeline/dnd/engine.test.ts
  • src/components/video-editor/timeline/dnd/engine.ts

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@meiiie meiiie merged commit 0259493 into main May 28, 2026
3 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.

1 participant