Fixed bug in RemovePoint, and improved the AddPoint KeyFrame method to remove a previous, duplicate point (based on co.X value).

This commit is contained in:
Jonathan Thomas
2015-12-15 18:12:24 -06:00
parent 121cfd342d
commit 90db687598
2 changed files with 20 additions and 1 deletions

View File

@@ -73,6 +73,12 @@ void Keyframe::AddPoint(Point p) {
// mark as dirty
needs_update = true;
// Check for duplicate point (and remove it)
Point closest = GetClosestPoint(p);
if (closest.co.X == p.co.X)
// Remove existing point
RemovePoint(closest);
// Add point at correct spot
Points.push_back(p);
@@ -464,7 +470,7 @@ void Keyframe::RemovePoint(Point p) throw(OutOfBoundsPoint) {
if (p.co.X == existing_point.co.X && p.co.Y == existing_point.co.Y) {
// Remove the matching point, and break out of loop
Points.erase(Points.begin() + x);
break;
return;
}
}