diff --git a/Source/Editor/GUI/Timeline/Timeline.cs b/Source/Editor/GUI/Timeline/Timeline.cs index 15e7eb953..1fb19e9ec 100644 --- a/Source/Editor/GUI/Timeline/Timeline.cs +++ b/Source/Editor/GUI/Timeline/Timeline.cs @@ -2148,10 +2148,9 @@ namespace FlaxEditor.GUI.Timeline /// public void ShowWholeTimeline() { - var viewWidth = Width; - var timelineWidth = Duration * UnitsPerSecond * Zoom + 8 * StartOffset; - _backgroundArea.ViewOffset = Float2.Zero; - Zoom = viewWidth / timelineWidth; + const float padding = 40f; + Zoom = (_backgroundArea.Width - padding * 2f) / (Duration * UnitsPerSecond); + _backgroundArea.ViewOffset = new Float2(-_leftEdge.X + padding, _backgroundArea.ViewOffset.Y); } /// diff --git a/Source/Editor/Windows/Assets/AnimationWindow.cs b/Source/Editor/Windows/Assets/AnimationWindow.cs index 268e18503..8dbcc5921 100644 --- a/Source/Editor/Windows/Assets/AnimationWindow.cs +++ b/Source/Editor/Windows/Assets/AnimationWindow.cs @@ -455,6 +455,7 @@ namespace FlaxEditor.Windows.Assets _timeline.Enabled = true; _timeline.SetNoTracksText(null); ClearEditedFlag(); + _timeline.ShowWholeTimeline(); } }