summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-11-14 00:33:05 -0500
committerDavid Robillard <d@drobilla.net>2014-11-14 00:33:05 -0500
commit14e53b89c7444dd9d0ce44c8c7e4d390005297a6 (patch)
tree97e5915e1e6543463978ec94a5bd5db055ae67b6 /gtk2_ardour
parent3b23aed5e177959a331bf282a2107c71211a0946 (diff)
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.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_drag.cc10
1 files 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