Merge branch 'SliderHoverColor' of https://github.com/xxSeys1/FlaxEngine into xxSeys1-SliderHoverColor

This commit is contained in:
Wojtek Figat
2025-04-07 21:50:25 +02:00

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,8 @@ namespace FlaxEditor.GUI.Input
Render2D.FillRectangle(lineRect, TrackLineColor);
// Draw thumb
Render2D.FillRectangle(_thumbRect, _isSliding ? ThumbColorSelected : ThumbColor);
bool mouseOverThumb = _thumbRect.Contains(PointFromWindow(Root.MousePosition));
Render2D.FillRectangle(_thumbRect, _isSliding ? ThumbColorSelected : mouseOverThumb ? ThumbColorHovered : ThumbColor);
}
/// <inheritdoc />