diff --git a/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs b/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs index 55a91eb82..bed67b63d 100644 --- a/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs +++ b/Source/Editor/GUI/Timeline/GUI/PositionHandle.cs @@ -47,7 +47,7 @@ namespace FlaxEditor.GUI.Timeline.GUI break; default: throw new ArgumentOutOfRangeException(); } - var color = (_timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground).AlphaMultiplied(0.6f); + var color = (_timeline.IsMovingPositionHandle ? style.SelectionBorder : 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); @@ -61,7 +61,8 @@ namespace FlaxEditor.GUI.Timeline.GUI 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)); + color = _timeline.IsMovingPositionHandle ? style.SelectionBorder : style.Foreground.RGBMultiplied(0.8f); + Render2D.FillRectangle(new Rectangle(Width * 0.5f, Height + timeAxisHeaderOffset, 1, _timeline.MediaPanel.Height - timeAxisHeaderOffset - timeAxisOverlap), color); base.Draw(); } diff --git a/Source/Editor/GUI/Timeline/GUI/TimelineEdge.cs b/Source/Editor/GUI/Timeline/GUI/TimelineEdge.cs index 779eb7ddf..0b76c11ef 100644 --- a/Source/Editor/GUI/Timeline/GUI/TimelineEdge.cs +++ b/Source/Editor/GUI/Timeline/GUI/TimelineEdge.cs @@ -42,7 +42,7 @@ namespace FlaxEditor.GUI.Timeline.GUI var timeAxisOverlap = Timeline.HeaderTopAreaHeight * 0.5f; var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y - timeAxisOverlap; - var moveColor = style.ProgressNormal; + var moveColor = style.SelectionBorder; var thickness = 2.0f; var borderColor = _isMoving ? moveColor : (IsMouseOver && _canEdit ? Color.Yellow : style.BorderNormal); Render2D.FillRectangle(new Rectangle((Width - thickness) * 0.5f, timeAxisHeaderOffset, thickness, Height - timeAxisHeaderOffset), borderColor); diff --git a/Source/Editor/GUI/Timeline/Media.cs b/Source/Editor/GUI/Timeline/Media.cs index e091f1e6a..a96ea21c5 100644 --- a/Source/Editor/GUI/Timeline/Media.cs +++ b/Source/Editor/GUI/Timeline/Media.cs @@ -100,7 +100,7 @@ namespace FlaxEditor.GUI.Timeline private Track _tack; private int _startFrame, _durationFrames; private Float2 _mouseLocation = Float2.Minimum; - private bool _isMoving; + internal bool _isMoving; private Float2 _startMoveLocation; private int _startMoveStartFrame; private int _startMoveDuration; @@ -347,7 +347,7 @@ namespace FlaxEditor.GUI.Timeline var isMovingWholeMedia = _isMoving && !_startMoveRightEdge && !_startMoveLeftEdge; var borderHighlightColor = style.BorderHighlighted; - var moveColor = style.ProgressNormal; + var moveColor = style.SelectionBorder; var selectedColor = style.BackgroundSelected; var moveThickness = 2.0f; var borderColor = isMovingWholeMedia ? moveColor : (Timeline.SelectedMedia.Contains(this) ? selectedColor : (IsMouseOver ? borderHighlightColor : style.BorderNormal)); diff --git a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs index 764b376dd..ef0cef279 100644 --- a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs +++ b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs @@ -1,6 +1,5 @@ // Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. -using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -183,6 +182,49 @@ namespace FlaxEditor.GUI.Timeline.Tracks base.OnDurationFramesChanged(); } + /// + public override bool ContainsPoint(ref Float2 location, bool precise = false) + { + if (Timeline.Zoom > 0.5f && !IsContinuous) + { + // Hit-test dot + var size = Height - 2.0f; + var rect = new Rectangle(new Float2(size * -0.5f) + Size * 0.5f, new Float2(size)); + return rect.Contains(ref location); + } + + return base.ContainsPoint(ref location, precise); + } + + /// + public override void Draw() + { + if (Timeline.Zoom > 0.5f && !IsContinuous) + { + // Draw more visible dot for the event that maintains size even when zooming out + var style = Style.Current; + var icon = Editor.Instance.Icons.VisjectBoxClosed32; + var size = Height - 2.0f; + var rect = new Rectangle(new Float2(size * -0.5f) + Size * 0.5f, new Float2(size)); + var outline = Color.Black; // Shadow + if (_isMoving) + outline = style.SelectionBorder; + else if (IsMouseOver) + outline = style.BorderHighlighted; + else if (Timeline.SelectedMedia.Contains(this)) + outline = style.BackgroundSelected; + Render2D.DrawSprite(icon, rect.MakeExpanded(6.0f), outline); + Render2D.DrawSprite(icon, rect, BackgroundColor); + + DrawChildren(); + } + else + { + // Default drawing + base.Draw(); + } + } + /// public override void OnDestroy() {