From 14e53b89c7444dd9d0ce44c8c7e4d390005297a6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 14 Nov 2014 00:33:05 -0500 Subject: [PATCH] Fix wonky note length when create-dragging notes backwards. Specifically, when pivoting from forwards to backwards (around the drag start point), the note length was too long. Setting both the start and end x coordinates of the rect every time to the right value does the right thing. --- gtk2_ardour/editor_drag.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 1f400310ae..0aaec8d24d 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -5280,12 +5280,10 @@ void NoteCreateDrag::motion (GdkEvent* event, bool) { _note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ()); - double const x = _editor->sample_to_pixel (_note[1]); - if (_note[1] > _note[0]) { - _drag_rect->set_x1 (x); - } else { - _drag_rect->set_x0 (x); - } + double const x0 = _editor->sample_to_pixel (_note[0]); + double const x1 = _editor->sample_to_pixel (_note[1]); + _drag_rect->set_x0 (std::min(x0, x1)); + _drag_rect->set_x1 (std::max(x0, x1)); } void -- 2.30.2