Fix incorrectly placed control points (y-axis). fixes #6647.

- also use the return from AutomationLine::drag_motion () in
	  anticipation of it correctly reporting its clamping to
	  AutomationRangeDrag.
This commit is contained in:
nick_m 2015-10-28 02:46:03 +11:00
parent 653e80ee21
commit fc8b03eef5
2 changed files with 13 additions and 13 deletions

View File

@ -694,7 +694,6 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
}
/* clamp y */
for (list<ControlPoint*>::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<double, float> (_drag_x + dx, _last_drag_fraction + dy);
return pair<double, float> (_drag_x + dx, fraction);
}
/** Should be called to indicate the end of a drag */

View File

@ -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<double, float> 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<Line>::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<double, float> 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));
}
}