From fb4cbb9f9ee61a5c0fec9fa43eff5a0e59d7f9ed Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 17 Sep 2019 16:56:15 +0200 Subject: Correctly handle Zoom > Edit-point > Mouse Previously this failed if the event was initiated outside of the canvas (e.g. Zoom buttons). This also fixes a special case of Zooming to an edit-point at zero. --- gtk2_ardour/editor_ops.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index c4c6f18ac8..48968378eb 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1800,7 +1800,13 @@ Editor::temporal_zoom (samplecnt_t fpp) new_page_size = (samplepos_t) floor (_visible_canvas_width * nfpp); half_page_size = new_page_size / 2; - switch (zoom_focus) { + Editing::ZoomFocus zf = zoom_focus; + + if (zf == ZoomFocusEdit && _edit_point == EditAtMouse) { + zf = ZoomFocusMouse; + } + + switch (zf) { case ZoomFocusLeft: leftmost_after_zoom = current_leftmost; break; @@ -1870,9 +1876,7 @@ Editor::temporal_zoom (samplecnt_t fpp) case ZoomFocusEdit: /* try to keep the edit point in the same place */ where = get_preferred_edit_position (); - - if (where > 0) { - + { double l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where); if (l < 0) { @@ -1882,10 +1886,6 @@ Editor::temporal_zoom (samplecnt_t fpp) } else { leftmost_after_zoom = (samplepos_t) l; } - - } else { - /* edit point not defined */ - return; } break; -- cgit v1.2.3