diff --git a/EgwCoreLib.BlazorTest/Pages/Test.razor b/EgwCoreLib.BlazorTest/Pages/Test.razor index c3f01db..902c00f 100644 --- a/EgwCoreLib.BlazorTest/Pages/Test.razor +++ b/EgwCoreLib.BlazorTest/Pages/Test.razor @@ -8,16 +8,16 @@
- +
- +
- +
- +
@@ -42,10 +42,16 @@ listBord02.Add("White"); listBord02.Add(""); listBord02.Add("White"); + listBord03 = new(); + listBord03.Add(""); + listBord03.Add("White"); + listBord03.Add(""); + listBord03.Add("Blue"); } protected List listBord01 { get; set; } = new(); protected List listBord02 { get; set; } = new(); + protected List listBord03 { get; set; } = new(); } diff --git a/EgwCoreLib.Razor/StepArrow.razor.cs b/EgwCoreLib.Razor/StepArrow.razor.cs index e927054..8eecb0b 100644 --- a/EgwCoreLib.Razor/StepArrow.razor.cs +++ b/EgwCoreLib.Razor/StepArrow.razor.cs @@ -34,7 +34,7 @@ namespace EgwCoreLib.Razor /// Angolo della freccia /// [Parameter] - public int SkewAngle { get; set; } = 36; + public int TipAngle { get; set; } = 108; /// /// Testo da mostrare @@ -65,9 +65,17 @@ namespace EgwCoreLib.Razor #region Protected Properties + /// + /// Angolo in radianti + /// + protected double radAngle + { + get => TipAngle * (Math.PI / 180); + } + protected int deltaX { - get => (int)Math.Round(rectH * Math.Sin(Math.PI * SkewAngle / 180), 0); + get => (int)Math.Round((rectH / 2) / Math.Tan(radAngle / 2), 0); } /// @@ -82,10 +90,14 @@ namespace EgwCoreLib.Razor if (StrokeColors.Count == 4) { var pList = pointList; - lineList.Add($"{pList[0]} {pList[1]}", StrokeColors[0]); - lineList.Add($"{pList[1]} {pList[2]} {pList[3]}", StrokeColors[1]); - lineList.Add($"{pList[3]} {pList[4]}", StrokeColors[2]); - lineList.Add($"{pList[4]} {pList[5]} {pList[0]}", StrokeColors[3]); + if (!string.IsNullOrEmpty(StrokeColors[0])) + lineList.Add($"{pList[0]} {pList[1]}", StrokeColors[0]); + if (!string.IsNullOrEmpty(StrokeColors[1])) + lineList.Add($"{pList[1]} {pList[2]} {pList[3]}", StrokeColors[1]); + if (!string.IsNullOrEmpty(StrokeColors[2])) + lineList.Add($"{pList[3]} {pList[4]}", StrokeColors[2]); + if (!string.IsNullOrEmpty(StrokeColors[3])) + lineList.Add($"{pList[4]} {pList[5]} {pList[0]}", StrokeColors[3]); } return lineList; } @@ -101,12 +113,12 @@ namespace EgwCoreLib.Razor { string[] pList = new string[6]; // aggiungo 1:1 i punti - pList[0] = "0,0"; - pList[1] = $"{rectW - deltaX},0 "; - pList[2] = $"{rectW},{rectH / 2} "; - pList[3] = $"{rectW - deltaX},{rectH} "; - pList[4] = $"0,{rectH} "; - pList[5] = $"{deltaX},{rectH / 2} "; + pList[0] = $"{StrokeWidth},{StrokeWidth}"; + pList[1] = $"{rectW - deltaX},{StrokeWidth}"; + pList[2] = $"{rectW},{rectH / 2}"; + pList[3] = $"{rectW - deltaX},{rectH}"; + pList[4] = $"{StrokeWidth},{rectH}"; + pList[5] = $"{deltaX},{rectH / 2}"; return pList; } }