change slider thumb color on hover

This commit is contained in:
xxSeys1
2025-04-06 14:36:37 +02:00
parent 368ef9185b
commit 628bffd63e

View File

@@ -71,20 +71,25 @@ namespace FlaxEditor.GUI.Input
public Action ValueChanged;
/// <summary>
/// The color of the slider track line
/// The color of the slider track line.
/// </summary>
public Color TrackLineColor { get; set; }
/// <summary>
/// The color of the slider thumb when it's not selected
/// The color of the slider thumb when it's not selected.
/// </summary>
public Color ThumbColor { get; set; }
/// <summary>
/// The color of the slider thumb when it's selected
/// The color of the slider thumb when it's selected.
/// </summary>
public Color ThumbColorSelected { get; set; }
/// <summary>
/// The color of the slider thumb when it's hovered.
/// </summary>
public Color ThumbColorHovered { get; set; }
/// <summary>
/// Gets a value indicating whether user is using a slider.
/// </summary>
@@ -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));
}
/// <inheritdoc />