From 628bffd63ef30e5a0c92af7f5bd07e378fbb4d91 Mon Sep 17 00:00:00 2001 From: xxSeys1 Date: Sun, 6 Apr 2025 14:36:37 +0200 Subject: [PATCH] change slider thumb color on hover --- Source/Editor/GUI/Input/SliderControl.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/Editor/GUI/Input/SliderControl.cs b/Source/Editor/GUI/Input/SliderControl.cs index a80b5e230..ea5fcab1f 100644 --- a/Source/Editor/GUI/Input/SliderControl.cs +++ b/Source/Editor/GUI/Input/SliderControl.cs @@ -71,20 +71,25 @@ namespace FlaxEditor.GUI.Input public Action ValueChanged; /// - /// The color of the slider track line + /// The color of the slider track line. /// public Color TrackLineColor { get; set; } /// - /// The color of the slider thumb when it's not selected + /// The color of the slider thumb when it's not selected. /// public Color ThumbColor { get; set; } /// - /// The color of the slider thumb when it's selected + /// The color of the slider thumb when it's selected. /// public Color ThumbColorSelected { get; set; } + /// + /// The color of the slider thumb when it's hovered. + /// + public Color ThumbColorHovered { get; set; } + /// /// Gets a value indicating whether user is using a slider. /// @@ -112,6 +117,7 @@ namespace FlaxEditor.GUI.Input TrackLineColor = style.BackgroundHighlighted; ThumbColor = style.BackgroundNormal; ThumbColorSelected = style.BackgroundSelected; + ThumbColorHovered = style.BackgroundHighlighted; } private void UpdateThumb() @@ -151,7 +157,7 @@ namespace FlaxEditor.GUI.Input Render2D.FillRectangle(lineRect, TrackLineColor); // Draw thumb - Render2D.FillRectangle(_thumbRect, _isSliding ? ThumbColorSelected : ThumbColor); + Render2D.FillRectangle(_thumbRect, _isSliding ? ThumbColorSelected : (_thumbRect.Contains(PointFromWindow(Root.MousePosition)) ? ThumbColorHovered : ThumbColor)); } ///