Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/components/HelpModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,24 @@ export default function HelpModal({ onClose }: HelpModalProps) {
<kbd>Spacebar</kbd> - Play/Pause
</li>
<li>
<kbd>Esc</kbd> - Close this help modal
<kbd>Esc</kbd> - Close this help modal / deselect clip
</li>
<li>
<kbd>Delete</kbd> / <kbd>Backspace</kbd> - Delete selected clip
</li>
</ul>
</section>

<section className="help-section">
<h3 className="help-section-title">Timeline Navigation</h3>
<ul className="help-shortcuts">
<li>
<kbd>Scroll</kbd> - Zoom in / out
</li>
<li>
<kbd>Shift</kbd> + <kbd>Scroll</kbd> - Pan earlier / later
</li>
<li>Horizontal trackpad swipe also pans the timeline</li>
</ul>
</section>

Expand Down
13 changes: 10 additions & 3 deletions src/components/Timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,17 @@ export default function Timeline({ sfxClips, libraryItems, onSfxChange }: Timeli
const onWheel = (e: WheelEvent) => {
e.preventDefault();

// Shift+scroll or horizontal trackpad swipe -> pan left/right
const isPan = e.shiftKey || Math.abs(e.deltaX) > Math.abs(e.deltaY);
if (isPan) {
const scrollDelta = e.shiftKey ? e.deltaY : e.deltaX;
el.scrollLeft = Math.max(0, el.scrollLeft + scrollDelta);
return;
}

// Vertical scroll -> zoom, anchored to mouse position
const oldPps = pxPerSecRef.current;
const delta = e.deltaY !== 0 ? e.deltaY : -e.deltaX;
const factor = 1 - delta * ZOOM_SENSITIVITY;
// prevent zooming out enough to see the canvas end
const factor = 1 - e.deltaY * ZOOM_SENSITIVITY;
const minPps = Math.max(
MIN_PX_PER_SEC,
containerWidthRef.current / effectiveDurationRef.current,
Expand Down
Loading