From: nick_m Date: Thu, 23 Feb 2017 14:11:56 +0000 (+1100) Subject: also fix flying percussive hits while copy-dragging. X-Git-Tag: 5.7~47 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=62cef7feff290d679bae522d1389ca07ca6a7cb5 also fix flying percussive hits while copy-dragging. --- diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 58db852659..2ce865e3b0 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2675,8 +2675,17 @@ MidiRegionView::move_copies (double dx_qn, double dy, double cumulative_dy) to_play.push_back (n->note()); } double const note_time_qn = session_relative_qn (n->note()->time().to_double()); - double const dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn)) - - n->item()->item_to_canvas (ArdourCanvas::Duple (n->x0(), 0)).x; + double dx = 0.0; + if (midi_view()->note_mode() == Sustained) { + dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn)) + - n->item()->item_to_canvas (ArdourCanvas::Duple (n->x0(), 0)).x; + } else { + Hit* hit = dynamic_cast(n); + if (hit) { + dx = editor->sample_to_pixel_unrounded (tmap.frame_at_quarter_note (note_time_qn + dx_qn)) + - n->item()->item_to_canvas (ArdourCanvas::Duple (((hit->x0() + hit->x1()) / 2.0) - hit->position().x, 0)).x; + } + } (*i)->move_event(dx, dy);