Revert "Feature/shader radial menu" due to shader issue (#36470)

This commit is contained in:
Pieter-Jan Briers
2025-04-11 23:30:52 +02:00
committed by GitHub
parent 86620dbe6c
commit e6e60dead4
5 changed files with 55 additions and 272 deletions

View File

@@ -362,12 +362,12 @@ public interface IRadialMenuItemWithSector
/// <summary>
/// Angle in radian where button sector should start.
/// </summary>
public float AngleSectorFrom { set; get; }
public float AngleSectorFrom { set; }
/// <summary>
/// Angle in radian where button sector should end.
/// </summary>
public float AngleSectorTo { set; get; }
public float AngleSectorTo { set; }
/// <summary>
/// Outer radius for drawing segment and pointer detection.
@@ -388,41 +388,6 @@ public interface IRadialMenuItemWithSector
/// Coordinates of center in parent component - button container.
/// </summary>
public Vector2 ParentCenter { set; }
/// <summary>
/// Marker, is menu item hovered currently.
/// </summary>
public bool IsHovered { get; }
/// <summary>
/// Color for menu item background when it is hovered over.
/// </summary>
Color HoverBackgroundColor { get; }
/// <summary>
/// Color for menu item default state.
/// </summary>
Color BackgroundColor { get; }
/// <summary>
/// Color for menu item border when item is hovered over.
/// </summary>
Color HoverBorderColor { get; }
/// <summary>
/// Color for menu item border default state.
/// </summary>
Color BorderColor { get; }
/// <summary>
/// Marker, if menu item background should be drawn.
/// </summary>
public bool DrawBackground { get; }
/// <summary>
/// Marker, if menu item borders should be drawn.
/// </summary>
public bool DrawBorder { get; }
}
[Virtual]
@@ -448,7 +413,7 @@ public class RadialMenuTextureButtonWithSector : RadialMenuTextureButton, IRadia
/// Marker, that controls if border of segment should be rendered. Is false by default.
/// </summary>
/// <remarks>
/// Default color of border is same as color of background. Use <see cref="BorderColor"/>
/// By default color of border is same as color of background. Use <see cref="BorderColor"/>
/// and <see cref="HoverBorderColor"/> to change it.
/// </remarks>
public bool DrawBorder { get; set; } = false;
@@ -494,6 +459,12 @@ public class RadialMenuTextureButtonWithSector : RadialMenuTextureButton, IRadia
set => _hoverBorderColorSrgb = Color.ToSrgb(value);
}
/// <summary>
/// Color of separator lines.
/// Separator lines are used to visually separate sector of radial menu items.
/// </summary>
public Color SeparatorColor { get; set; } = new Color(128, 128, 128, 128);
/// <inheritdoc />
float IRadialMenuItemWithSector.AngleSectorFrom
{
@@ -502,7 +473,6 @@ public class RadialMenuTextureButtonWithSector : RadialMenuTextureButton, IRadia
_angleSectorFrom = value;
_isWholeCircle = IsWholeCircle(value, _angleSectorTo);
}
get => _angleSectorFrom;
}
/// <inheritdoc />
@@ -513,7 +483,6 @@ public class RadialMenuTextureButtonWithSector : RadialMenuTextureButton, IRadia
_angleSectorTo = value;
_isWholeCircle = IsWholeCircle(_angleSectorFrom, value);
}
get => _angleSectorTo;
}
/// <inheritdoc />
@@ -535,6 +504,44 @@ public class RadialMenuTextureButtonWithSector : RadialMenuTextureButton, IRadia
{
}
/// <inheritdoc />
protected override void Draw(DrawingHandleScreen handle)
{
base.Draw(handle);
if (_parentCenter == null)
{
return;
}
// draw sector where space that button occupies actually is
var containerCenter = (_parentCenter.Value - Position) * UIScale;
var angleFrom = _angleSectorFrom + _angleOffset;
var angleTo = _angleSectorTo + _angleOffset;
if (DrawBackground)
{
var segmentColor = DrawMode == DrawModeEnum.Hover
? _hoverBackgroundColorSrgb
: _backgroundColorSrgb;
DrawAnnulusSector(handle, containerCenter, _innerRadius * UIScale, _outerRadius * UIScale, angleFrom, angleTo, segmentColor);
}
if (DrawBorder)
{
var borderColor = DrawMode == DrawModeEnum.Hover
? _hoverBorderColorSrgb
: _borderColorSrgb;
DrawAnnulusSector(handle, containerCenter, _innerRadius * UIScale, _outerRadius * UIScale, angleFrom, angleTo, borderColor, false);
}
if (!_isWholeCircle && DrawBorder)
{
DrawSeparatorLines(handle, containerCenter, _innerRadius * UIScale, _outerRadius * UIScale, angleFrom, angleTo, SeparatorColor);
}
}
/// <inheritdoc />
protected override bool HasPoint(Vector2 point)
{