diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 72cf283ff4..edefa38ac0 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -694,7 +694,6 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool } /* clamp y */ - for (list::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) { double const y = ((_height - (*i)->get_y()) / _height) + dy; if (y < 0) { @@ -736,7 +735,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool _last_drag_fraction = fraction; did_push = with_push; - return pair (_drag_x + dx, _last_drag_fraction + dy); + return pair (_drag_x + dx, fraction); } /** Should be called to indicate the end of a drag */ diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 963dbfe429..7667d93d57 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -4228,15 +4228,15 @@ ControlPointDrag::motion (GdkEvent* event, bool first_motion) _cumulative_x_drag = cx - _fixed_grab_x; _cumulative_y_drag = cy - _fixed_grab_y; + cx = max (0.0, cx); + cy = max (0.0, cy); + cy = min ((double) _point->line().height(), cy); + // make sure we hit zero when passing through if ((cy < zero_gain_y && (cy - dy) > zero_gain_y) || (cy > zero_gain_y && (cy - dy) < zero_gain_y)) { cy = zero_gain_y; } - cx = max (0.0, cx); - cy = max (0.0, cy); - cy = min ((double) _point->line().height(), cy); - framepos_t cx_frames = _editor->pixel_to_sample (cx) + snap_delta (event->button.state); if (!_x_constrained && need_snap) { @@ -4249,13 +4249,14 @@ ControlPointDrag::motion (GdkEvent* event, bool first_motion) float const fraction = 1.0 - (cy / _point->line().height()); if (first_motion) { + float const initial_fraction = 1.0 - (_fixed_grab_y / _point->line().height()); _editor->begin_reversible_command (_("automation event move")); - _point->line().start_drag_single (_point, _fixed_grab_x, fraction); + _point->line().start_drag_single (_point, _fixed_grab_x, initial_fraction); } + pair result; + result = _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index); - _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index); - - show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction)); + show_verbose_cursor_text (_point->line().get_verbose_cursor_string (result.second)); } void @@ -4269,7 +4270,6 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred) } } else { - motion (event, false); _point->line().end_drag (_pushing, _final_index); _editor->commit_reversible_command (); } @@ -5785,9 +5785,10 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move) for (list::iterator l = _lines.begin(); l != _lines.end(); ++l) { float const f = y_fraction (l->line, current_pointer_y()); /* we are ignoring x position for this drag, so we can just pass in anything */ + pair result; uint32_t ignored; - l->line->drag_motion (0, f, true, false, ignored); - show_verbose_cursor_text (l->line->get_verbose_cursor_relative_string (l->original_fraction, f)); + result = l->line->drag_motion (0, f, true, false, ignored); + show_verbose_cursor_text (l->line->get_verbose_cursor_relative_string (l->original_fraction, result.second)); } }