From 37a7d87786b3eda771390f0922e85074e5527291 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Wed, 7 Sep 2016 13:06:33 +1000 Subject: Use the frame corresponding to the current mouse position when zoom dragging Editor::mouse_frame only works within the track canvas. If a zoom drag is initiated and the mouse cursor goes outside of the track canvas the zoom position should still based on the current x position of the cursor. --- gtk2_ardour/editor_ops.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'gtk2_ardour/editor_ops.cc') diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index e074755a5f..0037ac8bc7 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1768,6 +1768,7 @@ Editor::temporal_zoom (framecnt_t fpp) framepos_t leftmost_after_zoom = 0; framepos_t where; bool in_track_canvas; + bool use_mouse_frame = true; framecnt_t nfpp; double l; @@ -1828,18 +1829,13 @@ Editor::temporal_zoom (framecnt_t fpp) case ZoomFocusMouse: /* try to keep the mouse over the same point in the display */ - if (!mouse_frame (where, in_track_canvas)) { - /* use playhead instead */ - where = playhead_cursor->current_frame (); - - if (where < half_page_size) { - leftmost_after_zoom = 0; - } else { - leftmost_after_zoom = where - half_page_size; - } - - } else { + if (_drags->active()) { + where = _drags->current_pointer_frame (); + } else if (!mouse_frame (where, in_track_canvas)) { + use_mouse_frame = false; + } + if (use_mouse_frame) { l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where); if (l < 0) { @@ -1849,8 +1845,16 @@ Editor::temporal_zoom (framecnt_t fpp) } else { leftmost_after_zoom = (framepos_t) l; } - } + } else { + /* use playhead instead */ + where = playhead_cursor->current_frame (); + if (where < half_page_size) { + leftmost_after_zoom = 0; + } else { + leftmost_after_zoom = where - half_page_size; + } + } break; case ZoomFocusEdit: -- cgit v1.2.3