added autoscrolling when seeking the timeline

This commit is contained in:
itsmattkc
2019-01-08 22:36:18 +11:00
parent d43cb42f02
commit 090a27ffef
3 changed files with 16 additions and 0 deletions
+13
View File
@@ -475,6 +475,19 @@ void Timeline::select_all() {
}
}
void Timeline::scroll_to_frame(long frame) {
if (sequence != NULL) {
int screen_point = getTimelineScreenPointFromFrame(frame);
int min_x = timeline_area->width()*0.1;
int max_x = timeline_area->width()*0.9;
if (screen_point < min_x) {
horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, frame) - min_x);
} else if (screen_point > max_x) {
horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, frame) - max_x);
}
}
}
void Timeline::resizeEvent(QResizeEvent *event) {
if (sequence != NULL) set_sb_max();
}
+2
View File
@@ -203,6 +203,8 @@ public:
QPushButton* toolTransitionButton;
QPushButton* snappingButton;
void scroll_to_frame(long frame);
void resizeEvent(QResizeEvent *event);
public slots:
void repaint_timeline();
+1
View File
@@ -237,6 +237,7 @@ bool frame_rate_is_droppable(float rate) {
void Viewer::seek(long p) {
pause();
seq->playhead = p;
if (main_sequence) panel_timeline->scroll_to_frame(p);
update_parents();
reset_all_audio();
audio_scrub = true;