Fix position of viewport after a playhead drag outside the viewport (when following the playhead).

git-svn-id: svn://localhost/ardour2/branches/3.0@11399 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-01-31 19:24:26 +00:00
parent 9383f8e09e
commit 3b5787c461
1 changed files with 13 additions and 12 deletions

View File

@ -5102,32 +5102,33 @@ Editor::reset_x_origin_to_follow_playhead ()
} else {
framepos_t l = 0;
if (frame < leftmost_frame) {
/* moving left */
framepos_t l = 0;
if (_session->transport_rolling()) {
/* rolling; end up with the playhead at the right of the page */
l = frame - current_page_frames ();
} else {
/* not rolling: end up with the playhead 3/4 of the way along the page */
l = frame - (3 * current_page_frames() / 4);
/* not rolling: end up with the playhead 1/4 of the way along the page */
l = frame - current_page_frames() / 4;
}
if (l < 0) {
l = 0;
}
center_screen_internal (l + (current_page_frames() / 2), current_page_frames ());
} else {
/* moving right */
if (_session->transport_rolling()) {
/* rolling: end up with the playhead on the left of the page */
center_screen_internal (frame + (current_page_frames() / 2), current_page_frames ());
l = frame;
} else {
/* not rolling: end up with the playhead 1/4 of the way along the page */
center_screen_internal (frame + (current_page_frames() / 4), current_page_frames ());
/* not rolling: end up with the playhead 3/4 of the way along the page */
l = frame - 3 * current_page_frames() / 4;
}
}
if (l < 0) {
l = 0;
}
center_screen_internal (l + (current_page_frames() / 2), current_page_frames ());
}
}
}