From ab024c7601fd38e9f73eba25b7fc95cfbb31016f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 22 Oct 2011 23:18:54 +0000 Subject: [PATCH] Fix snap of note drags when the region position is not itself snapped to the grid (#4322). git-svn-id: svn://localhost/ardour2/branches/3.0@10288 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_drag.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index b6b17d27e3..de1b66891f 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3861,11 +3861,13 @@ NoteDrag::total_dx () const /* new time of the primary note in session frames */ frameoffset_t st = n + dx; + framepos_t const rp = _region->region()->position (); + /* prevent the note being dragged earlier than the region's position */ - st = max (st, _region->region()->position ()); + st = max (st, rp); /* snap and return corresponding delta */ - return _region->snap_frame_to_frame (st) - n; + return _region->snap_frame_to_frame (st - rp) + rp - n; } /** @return Current total drag y change in note number */