inizio gestione homeCard
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<svg viewBox="0 0 @ObjW @ObjH" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(0,@LineDist)">
|
||||
<foreignObject width="@TextAreaWidth" height="@TextAreaHeight">
|
||||
<div class="row" style="@TextStyle">
|
||||
@foreach (var item in TextData)
|
||||
{
|
||||
<div class="@LeftTextClass">
|
||||
@item.Key
|
||||
</div>
|
||||
<div class="@RightTextClass text-end">
|
||||
<b>@item.Value</b>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</foreignObject>
|
||||
</g>
|
||||
|
||||
<line x1="@BaseLine.p1.px" y1="@BaseLine.p1.py" x2="@BaseLine.p2.px" y2="@BaseLine.p2.py" stroke="@LineColor" stroke-width="@LineWidth" />
|
||||
<circle id="circleLine" cx="@CircleLine.cx" cy="@CircleLine.cy" r="@CircleLine.rad" stroke="@LineColor" stroke-width="@LineWidth" />
|
||||
|
||||
<defs>
|
||||
<pattern id="@($"contImg_{ObjId}")" patternContentUnits="userSpaceOnUse" width="1" height="1">
|
||||
<image x="0" y="0" href="@ImagePath" width="50%" height="100%"></image>
|
||||
</pattern>
|
||||
</defs>
|
||||
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" @onclick="()=>execFunc()" style="cursor: pointer" />
|
||||
</svg>
|
||||
@@ -0,0 +1,163 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace WebDoorCreator.UI.Components.SvgComp
|
||||
{
|
||||
public partial class HomeCard
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ExeFunct { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string ImagePath { get; set; } = "images/LogoEgw.png";
|
||||
|
||||
[Parameter]
|
||||
public string LineColor { get; set; } = "#00838F";
|
||||
|
||||
[Parameter]
|
||||
public int LineWidth { get; set; } = 8;
|
||||
|
||||
[Parameter]
|
||||
public int ObjH { get; set; } = 204;
|
||||
|
||||
[Parameter]
|
||||
public int ObjId { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public int ObjW { get; set; } = 450;
|
||||
|
||||
[Parameter]
|
||||
public Dictionary<string, string> TextData { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
[Parameter]
|
||||
public string TextStyle { get; set; } = "font-size: 1.5em; fill: #000;";
|
||||
|
||||
[Parameter]
|
||||
public string Message1 { get; set; } = "";
|
||||
[Parameter]
|
||||
public string Message2 { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string LeftTextClass { get; set; } = "";
|
||||
[Parameter]
|
||||
public string RightTextClass { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected LineData BaseLine { get; set; } = null!;
|
||||
|
||||
protected CircleData CircleImg { get; set; } = null!;
|
||||
|
||||
protected CircleData CircleLine { get; set; } = null!;
|
||||
|
||||
protected int LineDist { get; set; } = 20;
|
||||
|
||||
protected int TextAreaHeight
|
||||
{
|
||||
get => (ObjH * 96 / 100);
|
||||
}
|
||||
|
||||
protected int TextAreaWidth
|
||||
{
|
||||
get => ObjW - (ObjH * 120 / 100);
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void execFunc()
|
||||
{
|
||||
EC_ExeFunct.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
setupGraphParams();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Protected Classes
|
||||
|
||||
protected class CircleData
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public CircleData(int px, int py, int radius)
|
||||
{
|
||||
cx = px;
|
||||
cy = py;
|
||||
rad = radius;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int cx { get; set; } = 0;
|
||||
public int cy { get; set; } = 0;
|
||||
public int rad { get; set; } = 100;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
protected class LineData
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public LineData(PointData pA, PointData pB)
|
||||
{
|
||||
p1 = pA;
|
||||
p2 = pB;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public PointData p1 { get; set; }
|
||||
public PointData p2 { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void setupGraphParams()
|
||||
{
|
||||
// calcolo i dati del cerchi...
|
||||
CircleLine = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - LineWidth) / 2);
|
||||
CircleImg = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - 2 * LineWidth) / 2);
|
||||
BaseLine = new LineData(new PointData(0, ObjH - LineWidth / 2), new PointData(ObjW - LineWidth - (ObjH / 2), ObjH - LineWidth / 2));
|
||||
LineDist = ObjH / 4;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user