summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-09-07 13:06:33 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-11-11 14:13:53 +1000
commit37a7d87786b3eda771390f0922e85074e5527291 (patch)
treec70e7833afe7f7bd737d8b373b0baec59f49f118 /gtk2_ardour/editor_ops.cc
parent9485748e17d0f122ed42ba353c08312d58dc188e (diff)
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.
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc28
1 files changed, 16 insertions, 12 deletions
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: