- Aggiunta Copy per Inglesina

- Iniziato a sistemare per converisone dimensione Inglesina
This commit is contained in:
Annamaria Sassi
2026-04-14 13:08:38 +02:00
parent d5fe7645dd
commit 5e4907479b
11 changed files with 259 additions and 59 deletions
+1 -1
View File
@@ -250,7 +250,7 @@ namespace Test.UI.Components.Pages
{
string fullPath = Path.Combine("Data", "AntaDoppia.jwd");
return File.ReadAllText(fullPath);
//return File.ReadAllText("Data\\AntaDoppia.jwd");
//return File.ReadAllText("Data\\AntaDoppiaInglesine.jwd");
}
}
}
+4 -2
View File
@@ -167,6 +167,7 @@
"GroupId": 4,
"AreaList": [
{
"Side": "BOTH",
"SplitShape": "HORIZONTAL",
"SplitStartVert": false,
"SplitVertList": [],
@@ -192,7 +193,7 @@
],
"GroupId": 7,
"AreaList": [],
"AreaType": "SPLIT"
"AreaType": "INGLESINA"
}
],
"AreaType": "FILL"
@@ -208,6 +209,7 @@
"GroupId": 6,
"AreaList": [
{
"Side": "BOTH",
"SplitShape": "HORIZONTAL",
"SplitStartVert": false,
"SplitVertList": [],
@@ -233,7 +235,7 @@
],
"GroupId": 8,
"AreaList": [],
"AreaType": "SPLIT"
"AreaType": "INGLESINA"
}
],
"AreaType": "FILL"
+3
View File
@@ -111,6 +111,9 @@
<div class="col-md-4">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AddSplitToSash()">Split</button>
</div>
}
@if (!User && CurrAnta.AreaList[0].AreaList.Count == 0)
{
<div class="col-md-4 px-2">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AddInglesinaToSash()">Inglesina</button>
</div>
+8 -4
View File
@@ -26,12 +26,16 @@
</select>
</div>
</div>
<div class="d-flex justify-content-between align-items-center pt-2">
<h5>Inglesina</h5>
<div class="d-flex justify-content-start align-items-center py-2">
<div class="col-lg-2 justify-content-start">
<h5>Inglesina</h5>
</div>
@if (!User)
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea()">Remove split</button>
<div class="col-lg-10 justify-content-start">
<div class="input-group">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea()">Remove inglesina</button>
</div>
</div>
}
</div>
+14 -14
View File
@@ -264,20 +264,20 @@ namespace WebWindowComplex.Compo
}
}
protected async Task UpdateSplit(DataUpdateSplit updRec)
{
if (updRec.currSplit != null)
{
CurrSplit = updRec.currSplit;
var args = new DataUpdateSplit()
{
currSplit = CurrSplit,
noSvg = updRec.noSvg
};
//await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
await EC_UpdateSplit.InvokeAsync(args);
}
}
//protected async Task UpdateSplit(DataUpdateSplit updRec)
//{
// if (updRec.currSplit != null)
// {
// CurrSplit = updRec.currSplit;
// var args = new DataUpdateSplit()
// {
// currSplit = CurrSplit,
// noSvg = updRec.noSvg
// };
// //await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
// await EC_UpdateSplit.InvokeAsync(args);
// }
//}
/// <summary>
/// Metodo per cambiare la dimensione principale
+122 -17
View File
@@ -1,4 +1,5 @@
using System.Linq;
using WebWindowComplex.Compo;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
@@ -281,9 +282,11 @@ namespace WebWindowComplex.Models
if (node != null)
{
if (node.AreaType.Equals(AreaTypes.SASH))
UpdateDimSubArea((Sash)node, dim, nameDim);
UpdateSash((Sash)node, dim, nameDim);
else if (node.AreaType.Equals(AreaTypes.SPLIT))
UpdateDimSubArea((Split)node, dim, nameDim);
UpdateSplit((Split)node, dim, nameDim);
else if (node.AreaType.Equals(AreaTypes.INGLESINA))
UpdateSplit((Inglesina)node, dim, nameDim);
for (int i = 0; i < node.AreaList.Count; i++)
{
if (node.AreaType.Equals(AreaTypes.SASH))
@@ -295,36 +298,36 @@ namespace WebWindowComplex.Models
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
if (nameDim.Equals("Width") && s.SashList.First().ElementDimensionList.Count > 0)
{
if (s.ParentArea.ParentArea is Split)
dimTot = dim + s.SashList.First().ElementDimensionList.Last().dOverlap
dimTot = dim + s.SashList.First().ElementDimensionList.Last().dOverlap
+ s.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap;
double widthAnta = s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dimTot);
if(s.bIsDimensionLight || s.AreaList.ElementAt(i) is Split)
if (s.bIsDimensionLight || s.AreaList.ElementAt(i) is Split)
widthAnta = widthAnta - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
else if(s.AreaList.ElementAt(i).AreaList != null || s.AreaList.ElementAt(i).AreaList.Count > 0)
- s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
else if (s.AreaList.ElementAt(i).AreaList != null || s.AreaList.ElementAt(i).AreaList.Count > 0)
{
if(s.AreaList.ElementAt(i).AreaList.FirstOrDefault() is Split)
if (s.AreaList.ElementAt(i).AreaList.FirstOrDefault() is Split)
widthAnta = widthAnta - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
- s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
}
SearchAreaList(node.AreaList.ElementAt(i), widthAnta, nameDim);
}
else if(s.SashList.First().ElementDimensionList.Count > 0)
else if (s.SashList.First().ElementDimensionList.Count > 0)
{
if(s.ParentArea is Split split && split.SplitHorizList.Count > 0)
if (s.ParentArea is Split split && split.SplitHorizList.Count > 0)
dimTot = dimTot + s.SashList.ElementAt(i).ElementDimensionList.First().dOverlap
+ s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dOverlap;
if(s.SashBottomRailQty > 0)
+ s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dOverlap;
if (s.SashBottomRailQty > 0)
{
foreach (var bottomRail in s.BottomRailElemDimList)
dimTot = dimTot - bottomRail.dDimension
+ bottomRail.dOverlap;
+ bottomRail.dOverlap;
}
dimTot = dimTot - s.SashList.ElementAt(i).ElementDimensionList.First().dDimension
- s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension;
- s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension;
SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim);
}
}
@@ -339,9 +342,9 @@ namespace WebWindowComplex.Models
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
if (nameDim.Equals("Width"))
{
if(s.AreaList.ElementAt(i).AreaList.First() is Sash sash && sash != null)
if (s.AreaList.ElementAt(i).AreaList.First() is Sash sash && sash != null)
dimTot = dimTot + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap
+ sash.SashList.First().ElementDimensionList.Last().dOverlap;
+ sash.SashList.First().ElementDimensionList.Last().dOverlap;
SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim);
}
else
@@ -369,6 +372,108 @@ namespace WebWindowComplex.Models
}
}
public void UpdateSash(Sash sash, double dim, string nameDim)
{
if (nameDim.Equals("Width"))
{
int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count();
int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count();
List<AreaDimension> dimList = new();
Split split = new Split(null, null);
if (sash.ParentArea.ParentArea is Split)
split = (Split)sash.ParentArea.ParentArea;
if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0))
{
Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault();
if (frame != null)
{
foreach (var i in frame.DimensionList)
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent));
}
}
else
{
foreach (var i in split.SplitVertList)
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent));
}
if (countAbsolute == sash.SashList.Count)
{
double sum = sash.SashList.Sum(x => x.dDimension);
if ((sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0))
{
for (int i = 1; i < sash.SashList.Count; i++)
dim = dim + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
}
else if (sash.ParentArea.ParentArea is Split && split.SplitVertList.Count > 0)
{
dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap
+ sash.SashList.First().ElementDimensionList.Last().dOverlap;
}
if (sash.bIsDimensionLight)
{
dim = dim - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.First().ElementDimensionList.Last().dDimension;
for (int i = 1; i < sash.SashList.Count; i++)
dim = dim - sash.SashList[i].ElementDimensionList.ElementAt(1).dDimension
- sash.SashList[i].ElementDimensionList.Last().dDimension
+ sash.SashList[i].ElementDimensionList.Last().dOverlap;
}
else if (sash.SashList.Count > 1)
{
for (int i = 1; i < sash.SashList.Count; i++)
dim = dim + sash.SashList[i].ElementDimensionList.Last().dOverlap;
}
double res = dim - sum;
foreach (var sashDim in sash.SashList)
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
}
else if (countAbsolute < sash.SashList.Count && countPercentage != sash.SashList.Count && countProportional != sash.SashList.Count)
{
if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0)
{
double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension);
var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
foreach (var i in percentageList)
i.SetDimension(i.ConvertAbsoluteIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim));
}
}
}
}
public void UpdateSplit(Split split, double dim, string nameDim)
{
List<SplitDimension> splitList = new();
List<SplitElementDimension> elemList = new();
double sum = 0;
if (nameDim.Equals("Width"))
{
splitList = split.SplitVertList;
elemList = split.ElemDimVertList;
}
else
{
splitList = split.SplitHorizList;
elemList = split.ElemDimHorizList;
}
int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
if (countAbsolute != 0 && countAbsolute == splitList.Count)
{
sum = sum + splitList.Sum(x => x.dDimension);
List<AreaDimension> dimensionList = new();
foreach (var i in splitList)
dimensionList.Add(new AreaDimension(i.dDimension, i.MeasureType, i.Parent));
double widthGlass = dim;
foreach (var item in elemList)
widthGlass = widthGlass - item.dDimension;
foreach (var item in splitList)
{
double widthPerc = item.ConvertDimension(dimensionList, item.MeasureType, MeasureTypes.PERCENTAGE, sum, splitList.IndexOf(item));
item.SetDimension(widthGlass * widthPerc / 100);
}
}
}
public void UpdateDimSubArea(Area area, double dim, string nameDim)
{
if (area is Sash sash && nameDim.Equals("Width"))
+8
View File
@@ -65,6 +65,14 @@ namespace WebWindowComplex.Models
newFill.SetGroupId(nCounterGroup);
newFill.SetFillType(SelFillType);
newFill.SetAreaType(AreaType);
if(AreaList != null && AreaList.Count > 0)
{
foreach (var item in AreaList)
{
Area newArea = item.Copy(newFill);
newFill.AreaList.Add(newArea);
}
}
return newFill;
}
+34
View File
@@ -60,6 +60,40 @@ namespace WebWindowComplex.Models
return inglesina;
}
public override Inglesina Copy(Area newParentArea)
{
Inglesina newInglesina = new Inglesina(newParentArea, m_ParentWindow);
AddCounterGroup();
newInglesina.SetGroupId(nCounterGroup);
newInglesina.SetSelSide(m_SelSide);
newInglesina.SetSplitStartVert(bSplitStartVert);
for (int i = 0; i < SplitVertList.Count; i++)
newInglesina.SplitVertList.Add(SplitVertList[i].Copy());
for (int i = 0; i < SplitHorizList.Count; i++)
newInglesina.SplitHorizList.Add(SplitHorizList[i].Copy());
newInglesina.SetSplitShape(SelSplitShape);
newInglesina.SetAreaType(AreaType);
foreach (var item in ElemDimHorizList)
{
SplitElementDimension newElementDimension = item.Copy();
newInglesina.ElemDimHorizList.Add(newElementDimension);
}
foreach (var item in ElemDimVertList)
{
SplitElementDimension newElementDimension = item.Copy();
newInglesina.ElemDimVertList.Add(newElementDimension);
}
if (AreaList != null && AreaList.Count > 0)
{
foreach (var item in AreaList)
{
Area a = item.Copy(newInglesina);
newInglesina.AreaList.Add(a);
}
}
return newInglesina;
}
internal void SetSelSide(SideInglesina side)
{
m_SelSide = side;
+15 -19
View File
@@ -630,14 +630,14 @@ namespace WebWindowComplex.Models
/// <returns></returns>
internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res)
{
if (area.Equals(this))
{
res.m_Dimension = height;
res.m_Found = true;
return res;
}
for (int i = 0; i < area.AreaList.Count; i++)
{
if (area.Equals(this))
{
res.m_Dimension = height;
res.m_Found = true;
return res;
}
Area item = area.AreaList[i];
if (area is Split split)
{
@@ -733,14 +733,14 @@ namespace WebWindowComplex.Models
/// <returns></returns>
internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res)
{
if (area.Equals(this))
{
res.m_Dimension = width;
res.m_Found = true;
return res;
}
for (int i = 0; i < area.AreaList.Count; i++)
{
if (area.Equals(this))
{
res.m_Dimension = width;
res.m_Found = true;
return res;
}
Area item = area.AreaList[i];
if (area is Split split)
{
@@ -791,17 +791,13 @@ namespace WebWindowComplex.Models
double widthTot = width;
double dim = 0;
if (sash.ParentArea.ParentArea is Split)
widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap
+ sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
if (sash.bIsDimensionLight)
{
widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.First().ElementDimensionList.Last().dDimension;
widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension - sash.SashList.First().ElementDimensionList.Last().dDimension;
for (int anta = 1; anta < sash.SashList.Count; anta++)
{
widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension
+ sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
}
}
else
+9 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.4.1313</Version>
<Version>3.1.4.1413</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -122,6 +122,14 @@
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.4.1313</Version>
<Version>3.1.4.1413</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione JWD per LUX</Description>
@@ -171,6 +171,46 @@