UI/MenuGlyph.razor
@using Sandbox.UI
@using System
@namespace Prototype
@inherits Panel
<root class="menu-glyph">
@foreach(var line in Strokes){<div class="menu-glyph-stroke" style="@line"></div>}
</root>
@code {
public string Kind { get; set; } = "home";
System.Collections.Generic.IEnumerable<string> Strokes {
get {
var paths = Kind switch {
"monitor" => new[]{"2,3 22,3 22,17 2,17 2,3","12,17 12,22","7,22 17,22"},
"speaker" => new[]{"2,9 7,9 13,3 13,21 7,15 2,15 2,9","17,7 20,10 20,14 17,17","20,3 24,8 24,16 20,21"},
"keyboard" => new[]{"1,5 23,5 23,20 1,20 1,5","5,9 7,9","11,9 13,9","17,9 19,9","5,13 7,13","11,13 13,13","17,13 19,13","6,17 18,17"},
"interface" => new[]{"8,2 2,2 2,8","16,2 22,2 22,8","2,16 2,22 8,22","16,22 22,22 22,16","8,12 16,12","12,8 12,16"},
"accessibility" => new[]{"10,2 14,2 14,6 10,6 10,2","3,9 12,11 21,9","12,11 12,16","12,16 6,23","12,16 18,23"},
"shield" => new[]{"12,2 21,6 20,14 17,19 12,23 7,19 4,14 3,6 12,2","12,7 12,16","8,12 16,12"},
"home" => new[]{"2,11 12,3 22,11","5,10 5,21 10,21 10,15 14,15 14,21 19,21 19,10"},
"skills" => new[]{"9,2 15,2 15,8 9,8 9,2","12,8 12,13","4,16 4,13 20,13 20,16","1,16 7,16 7,22 1,22 1,16","17,16 23,16 23,22 17,22 17,16"},
"trophy" => new[]{"6,3 18,3 18,10 15,14 9,14 6,10 6,3","6,5 2,5 2,9 7,12","18,5 22,5 22,9 17,12","12,14 12,20","7,21 17,21"},
"news" => new[]{"3,3 21,3 21,21 3,21 3,3","6,6 12,6 12,12 6,12 6,6","15,6 18,6","15,10 18,10","6,16 18,16"},
"settings" => new[]{"2,6 8,6","12,6 22,6","8,3 12,3 12,9 8,9 8,3","2,18 14,18","18,18 22,18","14,15 18,15 18,21 14,21 14,15"},
"plus" => new[]{"12,3 12,21","3,12 21,12"},
"check" => new[]{"3,12 9,18 21,5"},
"join" => new[]{"14,3 21,3 21,21 14,21","2,12 16,12","11,7 16,12 11,17"},
"leave" => new[]{"10,3 3,3 3,21 10,21","8,12 22,12","17,7 22,12 17,17"},
_ => new[]{"5,5 19,19","19,5 5,19"}
};
foreach(var path in paths){var points=path.Split(' ');for(int i=1;i<points.Length;i++){
var a=points[i-1].Split(',');var b=points[i].Split(',');float x=int.Parse(a[0]),y=int.Parse(a[1]),dx=int.Parse(b[0])-x,dy=int.Parse(b[1])-y;
yield return FormattableString.Invariant($"left:{x}px; top:{y}px; width:{MathF.Sqrt(dx*dx+dy*dy)}px; transform:rotate({MathF.Atan2(dy,dx)*180f/MathF.PI}deg);");
}}
}
}
protected override int BuildHash() => Kind.GetHashCode();
}