diff --git a/Source/Editor/GUI/CurveEditor.Contents.cs b/Source/Editor/GUI/CurveEditor.Contents.cs index 09e30d372..fd51be3fd 100644 --- a/Source/Editor/GUI/CurveEditor.Contents.cs +++ b/Source/Editor/GUI/CurveEditor.Contents.cs @@ -510,6 +510,27 @@ namespace FlaxEditor.GUI return true; } + /// + public override bool OnMouseDoubleClick(Float2 location, MouseButton button) + { + if (base.OnMouseDoubleClick(location, button)) + return true; + + // Add keyframe on double click + var child = GetChildAt(location); + if (child is not KeyframePoint && + child is not TangentPoint && + _editor.KeyframesCount < _editor.MaxKeyframes) + { + var viewRect = _editor._mainPanel.GetClientArea(); + var pos = PointToKeyframes(location, ref viewRect); + _editor.AddKeyframe(pos); + return true; + } + + return false; + } + /// public override bool OnMouseWheel(Float2 location, float delta) {