Skip to content

Commit

Permalink
feat: matching the tangent mode of new control point to neighbor one
Browse files Browse the repository at this point in the history
  • Loading branch information
witalosk committed Feb 15, 2025
1 parent d671357 commit 6bdf0f0
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,17 @@ private void AddControlPoint(Vector2 positionInCurve)
int idx = _curvePointContainer.AddKey(key);
_selectedControlPointIndex = idx;

// Match the tangent mode to neighborhood point one
var cp = _curvePointContainer.ControlPoints[_selectedControlPointIndex];
if (0 < idx)
{
cp.SetTangentMode(_curvePointContainer.ControlPoints[_selectedControlPointIndex - 1].OutTangentMode, null);
}
if (idx < _curvePointContainer.Count - 1)
{
cp.SetTangentMode(null, _curvePointContainer.ControlPoints[_selectedControlPointIndex + 1].InTangentMode);
}

UpdateView();
_propertyFieldController.UpdatePropertyFields();
OnCurveChanged?.Invoke(_curvePointContainer.Curve);
Expand Down

0 comments on commit 6bdf0f0

Please sign in to comment.