Zoom in/out on timeline based on cursor position

A helpful timeline feature is to allow zooming in and out based on the current position of the cursor.

When I am editing in the timeline, I frequently switch between zoomed-in views to make precision cuts, and zoomed-out views to get a macro view of the project. The cursor is always where I want to get more context: to go closer in for a trim or to go a little farther out to see what’s next. However, zooming in and out with the buttons on the bar usually puts my cursor off-screen and I have to grab the scroll bar and find my cursor again. It’s somewhat tedious to zoom, move the scroll bar, zoom, move the scroll bar, and repeat.

This is the bar I mean:

Zoom bar

I believe better default behavior is for the zoom to use the cursor position as how the timeline view is positioned. Best case, centering the cursor in the middle of the currenrtly-viewable timeline when clicking zoom is what I want. But even if it’s not centered, it helps to use the cursor as the reference point when zooming.

For me, this mirrors functionality in some professional-grade proprietary editing software and I realized I was missing it once I started to zoom a lot.

This is my first time requesting a feature. Does this seem useful? I’m curious to know if others find zooming in or out on the timeline based on cursor position as helpful or not. I don’t know what workflows from other people looks like.

1 Like

I agree with you

1 Like

Just use the scroll wheel, it’s easier. Just over over the zoom and bottom slider. The playhead always stays in view. Unless you force the bottom slider out of view by left click holding. Using the scroll wheel keeps everything in view.
2018-12-15_16-27-04

If you want to get from one split to the next use ALT + Left Arrow, or ALT + Right Arrow, among other keyboard shortcuts.

shotcut_2018-12-15_16-37-38shotcut_2018-12-15_16-37-49

3 Likes

Yes, but why the playhead moves to the left or right while it would be better if it stays in the middle, we would win the second manipulation.

I’ve suggested this before here with no support. Fixed playhead position in timeline window

Try this:
In the file: “Applications / Shotcut.app / Contents / Resources / shotcut / qml / timeline / Timeline.js” change the function “scrollIfNeeded” like this :

function scrollIfNeeded() {
var x = timeline.position * multitrack.scaleFactor;
if (!scrollView) return;
if (x > scrollView.flickableItem.contentX + scrollView.width * 0.5)
scrollView.flickableItem.contentX = x - scrollView.width * 0.5;
else if (x < scrollView.width * 0.5)
scrollView.flickableItem.contentX = 0;
else if (x < scrollView.flickableItem.contentX + scrollView.width * 0.5)
scrollView.flickableItem.contentX = x - scrollView.width * 0.5;
}

It seems to work properly, to check with use.

1 Like

Works pretty well.:+1::+1::+1:

Why do I seem unable to reproduce this? By “cursor,” I assume you mean play head and not the beginning of the selected clip.

Thank you for the contribution @Namna. I used your code to add a new option Center Playhead to the Timeline menu for the next version 19.01.x

2 Likes

Thanks for the integration in the 19.01.19 beta.
French Translation for “Center the playhead” in timeline menu is “Centrer la tête de lecture”

1 Like

Awesome, can’t wait to try this out! Thanks @Namna and @shotcut.

Bravo! Thanks for adding this. If you have ever used another editor that has this capability then the ‘roving’ playhead seems annoying. Again, thanks. -=Ken=-

1 Like