diff --git a/Source/Editor/GUI/Timeline/GUI/Background.cs b/Source/Editor/GUI/Timeline/GUI/Background.cs
index dc4909abb..b9eff562a 100644
--- a/Source/Editor/GUI/Timeline/GUI/Background.cs
+++ b/Source/Editor/GUI/Timeline/GUI/Background.cs
@@ -282,7 +282,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
var x = time * zoom + Timeline.StartOffset;
// Header line
- var lineRect = new Rectangle(x - 0.5f, -verticalLinesHeaderExtend + timeAxisHeaderOffset, 1.0f, verticalLinesHeaderExtend);
+ var lineRect = new Rectangle(x - 0.5f, -verticalLinesHeaderExtend * 0.6f + timeAxisHeaderOffset, 1.0f, verticalLinesHeaderExtend * 0.6f);
Render2D.FillRectangle(lineRect, lineColor);
// Time label
@@ -300,7 +300,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
break;
default: throw new ArgumentOutOfRangeException();
}
- var labelRect = new Rectangle(x + 2, -verticalLinesHeaderExtend + timeAxisHeaderOffset, 50, verticalLinesHeaderExtend);
+ var labelRect = new Rectangle(x + 2, -verticalLinesHeaderExtend * 0.8f + timeAxisHeaderOffset, 50, verticalLinesHeaderExtend);
Render2D.DrawText(style.FontSmall, labelText, labelRect, labelColor, TextAlignment.Near, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, 0.8f);
}
}
diff --git a/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs b/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs
index 7b42e86ab..046078d54 100644
--- a/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs
+++ b/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs
@@ -1,5 +1,7 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
+using System;
+using System.Globalization;
using FlaxEngine;
using FlaxEngine.GUI;
@@ -29,15 +31,39 @@ namespace FlaxEditor.GUI.Timeline.GUI
var icon = Editor.Instance.Icons.VisjectArrowClosed32;
var timeAxisOverlap = Timeline.HeaderTopAreaHeight * 0.5f;
var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y - timeAxisOverlap;
+
+ var timeShowMode = _timeline.TimeShowMode;
+ // Time label
+ string labelText;
+ switch (timeShowMode)
+ {
+ case Timeline.TimeShowModes.Frames:
+ labelText = _timeline.CurrentFrame.ToString("###0", CultureInfo.InvariantCulture);
+ break;
+ case Timeline.TimeShowModes.Seconds:
+ labelText = _timeline.CurrentTime.ToString("###0.##'s'", CultureInfo.InvariantCulture);
+ break;
+ case Timeline.TimeShowModes.Time:
+ labelText = TimeSpan.FromSeconds(_timeline.CurrentTime).ToString("g");
+ break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ var color = (_timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground).AlphaMultiplied(0.6f);
Matrix3x3.RotationZ(Mathf.PiOverTwo, out var m1);
var m2 = Matrix3x3.Translation2D(0, timeAxisHeaderOffset);
Matrix3x3.Multiply(ref m1, ref m2, out var m3);
Render2D.PushTransform(ref m3);
- Render2D.DrawSprite(icon, new Rectangle(new Float2(4, -Width), Size), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground);
+ // TODO: Convert to its own sprite or 9 slice
+ Render2D.DrawSprite(icon, new Rectangle(new Float2(10, -icon.Size.X * 0.5f), Size), color);
+ Render2D.FillRectangle(new Rectangle(new Float2(-6, -icon.Size.Y * 0.5f + 8), new Float2(timeAxisOverlap, 4)), color);
+ Render2D.PopTransform();
+ var textMatrix = Matrix3x3.Translation2D(12, timeAxisHeaderOffset);
+ Render2D.PushTransform(ref textMatrix);
+ Render2D.DrawText(style.FontSmall, labelText, style.Foreground, new Float2(2, -6));
Render2D.PopTransform();
- Render2D.FillRectangle(new Rectangle(Width * 0.5f, Height + timeAxisHeaderOffset, 1, _timeline.MediaPanel.Height - timeAxisHeaderOffset - timeAxisOverlap), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground.RGBMultiplied(0.8f));
+ Render2D.FillRectangle(new Rectangle(Width * 0.5f - 1, Height + timeAxisHeaderOffset, 1, _timeline.MediaPanel.Height - timeAxisHeaderOffset - timeAxisOverlap), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground.RGBMultiplied(0.8f));
base.Draw();
}
diff --git a/Source/Editor/GUI/Timeline/Timeline.UI.cs b/Source/Editor/GUI/Timeline/Timeline.UI.cs
index a977d487e..604db541c 100644
--- a/Source/Editor/GUI/Timeline/Timeline.UI.cs
+++ b/Source/Editor/GUI/Timeline/Timeline.UI.cs
@@ -50,6 +50,27 @@ namespace FlaxEditor.GUI.Timeline
}
}
+ ///
+ public override void OnMouseEnter(Float2 location)
+ {
+ base.OnMouseEnter(location);
+ Cursor = CursorType.Hand;
+ }
+
+ ///
+ public override void OnMouseLeave()
+ {
+ Cursor = CursorType.Default;
+ base.OnMouseLeave();
+ }
+
+ ///
+ public override void Defocus()
+ {
+ Cursor = CursorType.Default;
+ base.Defocus();
+ }
+
private void Seek(ref Float2 location)
{
if (_timeline.PlaybackState == PlaybackStates.Disabled)
diff --git a/Source/Editor/GUI/Timeline/Timeline.cs b/Source/Editor/GUI/Timeline/Timeline.cs
index 9800b2105..a32b35692 100644
--- a/Source/Editor/GUI/Timeline/Timeline.cs
+++ b/Source/Editor/GUI/Timeline/Timeline.cs
@@ -167,7 +167,7 @@ namespace FlaxEditor.GUI.Timeline
///
/// The header top area height (in pixels).
///
- public static readonly float HeaderTopAreaHeight = 22.0f;
+ public static readonly float HeaderTopAreaHeight = 40.0f;
///
/// The timeline units per second (on time axis).