153 lines
4.3 KiB
C#
153 lines
4.3 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace WebDoorCreator.UI.Components.SvgComp
|
|
{
|
|
public partial class HomeCard
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public string BodyStyle { get; set; } = "font-size: 2em;";
|
|
|
|
[Parameter]
|
|
public string BodyText { get; set; } = "Body Text";
|
|
|
|
[Parameter]
|
|
public string ButtonText { get; set; } = "Button Text";
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_ExeFunct { get; set; }
|
|
|
|
[Parameter]
|
|
public string ImagePath { get; set; } = "images/DOORBG.png";
|
|
|
|
[Parameter]
|
|
public string LineColor { get; set; } = "#3989CC";
|
|
|
|
[Parameter]
|
|
public int LineWidth { get; set; } = 16;
|
|
|
|
[Parameter]
|
|
public int ObjH { get; set; } = 204;
|
|
|
|
[Parameter]
|
|
public int ObjId { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public int ObjW { get; set; } = 450;
|
|
|
|
[Parameter]
|
|
public int StartPoint { get; set; } = 220;
|
|
|
|
[Parameter]
|
|
public string TitleStyle { get; set; } = "font-size: 5em;";
|
|
|
|
[Parameter]
|
|
public string TitleText { get; set; } = "Title Text";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected List<PointData> PathClip { get; set; } = null!;
|
|
|
|
protected string PathClipData
|
|
{
|
|
get
|
|
{
|
|
//string path = $"{PathLineData} L1200,0 L1920,0 L1920,1080 L900,1080 Z";
|
|
string path = PathLineData;
|
|
if (pathClipCloseList.Count > 0)
|
|
{
|
|
for (int i = 0; i < pathClipCloseList.Count; i++)
|
|
{
|
|
path += $" L{pathClipCloseList[i].px},{pathClipCloseList[i].py}";
|
|
}
|
|
}
|
|
path += " Z";
|
|
return path;
|
|
}
|
|
}
|
|
|
|
protected List<PointData> PathLine { get; set; } = null!;
|
|
|
|
protected string PathLineData
|
|
{
|
|
get
|
|
{
|
|
string path = "";
|
|
if (pathPointList.Count > 0)
|
|
{
|
|
path = $"M{pathPointList[0].px},{pathPointList[0].py} Q";
|
|
for (int i = 1; i < pathPointList.Count; i++)
|
|
{
|
|
path += $" {pathPointList[i].px},{pathPointList[i].py}";
|
|
}
|
|
}
|
|
return path;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void execFunc()
|
|
{
|
|
EC_ExeFunct.InvokeAsync(true);
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
setupGraphParams();
|
|
}
|
|
|
|
protected void setupGraphParams()
|
|
{
|
|
// calcolo i dati necessari a disegnare
|
|
int deltaX = 20;
|
|
int deltaY = 400;
|
|
// inizio aggiungendo punti parametrici
|
|
pathPointList.Add(new PointData(StartPoint, ObjH));
|
|
pathPointList.Add(new PointData(StartPoint + deltaX, ObjH - deltaY));
|
|
pathPointList.Add(new PointData(ObjW / 2, ObjH / 2));
|
|
pathPointList.Add(new PointData(ObjW - (StartPoint + deltaX), deltaY));
|
|
pathPointList.Add(new PointData(ObjW - StartPoint, 0));
|
|
// ora provvedo x la parte clip
|
|
pathClipCloseList.Add(new PointData(ObjW - StartPoint, 0));
|
|
pathClipCloseList.Add(new PointData(ObjW, 0));
|
|
pathClipCloseList.Add(new PointData(ObjW, ObjH));
|
|
pathClipCloseList.Add(new PointData(StartPoint, ObjH));
|
|
|
|
}
|
|
|
|
protected List<PointData> pathPointList = new List<PointData>();
|
|
protected List<PointData> pathClipCloseList = new List<PointData>();
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Protected Classes
|
|
|
|
protected class PointData
|
|
{
|
|
#region Public Constructors
|
|
|
|
public PointData(int valx, int valy)
|
|
{
|
|
px = valx;
|
|
py = valy;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public int px { get; set; } = 0;
|
|
public int py { get; set; } = 0;
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
#endregion Protected Classes
|
|
}
|
|
} |