13
0

automation drawn: ensure the right-to-left drawn lines are ordered correctly

This commit is contained in:
Paul Davis 2023-07-10 14:23:39 -06:00
parent 459659d229
commit d12aa315fc

View File

@ -7341,7 +7341,6 @@ AutomationDrawDrag::maybe_add_point (GdkEvent* ev, timepos_t const & cpos)
} }
add_point = true; add_point = true;
} }
} }
if (pop_point) { if (pop_point) {
@ -7372,14 +7371,23 @@ AutomationDrawDrag::finished (GdkEvent* event, bool motion_occured)
return; return;
} }
if (drawn_points.empty()) {
return;
}
AutomationTimeAxisView* atv = static_cast<AutomationTimeAxisView*>(base_rect.get_data ("trackview")); AutomationTimeAxisView* atv = static_cast<AutomationTimeAxisView*>(base_rect.get_data ("trackview"));
if (!atv) { if (!atv) {
return; return;
} }
/* ControlList::thin() works very badly with the stair-cased lines that /* Points must be in time order, so if the user draw right to left, fix
result from snapping. * that here
*/ */
if (drawn_points.front().when > drawn_points.back().when) {
std::reverse (drawn_points.begin(), drawn_points.end());
}
atv->merge_drawn_line (drawn_points, !did_snap); atv->merge_drawn_line (drawn_points, !did_snap);
} }