Fix display testo in obj svg

This commit is contained in:
Samuele Locatelli
2023-05-03 18:10:50 +02:00
parent 1f96279c91
commit e95650bfdf
4 changed files with 150 additions and 123 deletions
@@ -5,35 +5,14 @@
@foreach (var item in TextData)
{
<div class="col-4">
<i>@item.Key</i>
@item.Key
</div>
<div class="col-8">
<div class="col-8 text-end">
<b>@item.Value</b>
</div>
}
@*<div class="col-4">
<i>01</i>
</div>
<div class="col-8">
<b>@Text01</b>
</div>
<div class="col-4">
<i>02</i>
</div>
<div class="col-8">
<b>@Text02</b>
</div>
<div class="col-4">
<i>03</i>
</div>
<div class="col-8">
<b>@Text03</b>
</div>*@
</div>
</foreignObject>
@* <text id="TitleElem" style="@TextStyle" x="0" y="0">@Text01</text>
<text id="TitleElem" style="@TextStyle" x="0" y="@(1*LineDist)">@Text02</text>
<text id="TitleElem" style="@TextStyle" x="0" y="@(2*LineDist)">@Text03</text>*@
</g>
<line x1="@BaseLine.p1.px" y1="@BaseLine.p1.py" x2="@BaseLine.p2.px" y2="@BaseLine.p2.py" stroke="@LineColor" stroke-width="@LineWidth" />
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components;
using System.Data.SqlTypes;
namespace WebDoorCreator.UI.Components.SvgComp
{
@@ -7,38 +6,130 @@ namespace WebDoorCreator.UI.Components.SvgComp
{
#region Public Properties
[Parameter]
public int ObjId { get; set; } = 0;
[Parameter]
public string Text01 { get; set; } = "Example Text 01";
[Parameter]
public string Text02 { get; set; } = "Example Text 02";
[Parameter]
public string Text03 { get; set; } = "Example Text 03";
[Parameter]
public Dictionary<string,string> TextData { get; set; } = new Dictionary<string, string>();
[Parameter]
public string ImagePath { get; set; } = "images/LogoEgw.png";
[Parameter]
public string LineColor { get; set; } = "#00838F";
[Parameter]
public int ObjH { get; set; } = 204;
[Parameter]
public int ObjW { get; set; } = 450;
[Parameter]
public int LineWidth { get; set; } = 8;
[Parameter]
public string TextStyle { get; set; } = "font-size: 1.5em; font-weight:bold; fill: #000;";
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;";
#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 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()
{
@@ -49,63 +140,6 @@ namespace WebDoorCreator.UI.Components.SvgComp
LineDist = ObjH / 4;
}
protected override void OnParametersSet()
{
// fixme: togliere auto-compilazione text-data...
TextData.Add("riga01", "valore riga 01");
TextData.Add("riga02", "valore riga 02");
TextData.Add("riga03", "valore riga 03");
setupGraphParams();
}
#endregion Public Properties
protected CircleData CircleLine { get; set; } = null!;
protected CircleData CircleImg { get; set; } = null!;
protected LineData BaseLine { get; set; } = null!;
protected int LineDist { get; set; } = 20;
protected int TextAreaWidth
{
get => ObjW - (ObjH * 120 / 100);
}
protected int TextAreaHeight
{
get => (ObjH * 96 / 100);
}
protected class CircleData
{
public CircleData(int px, int py, int radius)
{
cx = px;
cy = py;
rad = radius;
}
public int cx { get; set; } = 0;
public int cy { get; set; } = 0;
public int rad { get; set; } = 100;
}
protected class PointData
{
public PointData(int valx, int valy)
{
px = valx;
py = valy;
}
public int px { get; set; } = 0;
public int py { get; set; } = 0;
}
protected class LineData
{
public LineData(PointData pA, PointData pB)
{
p1 = pA;
p2 = pB;
}
public PointData p1 { get; set; }
public PointData p2 { get; set; }
}
#endregion Private Methods
}
}