Correzioni

This commit is contained in:
Annamaria Sassi
2026-02-19 17:15:28 +01:00
parent 5fc60445ac
commit e0bb0ddb20
12 changed files with 57 additions and 80 deletions
+7 -14
View File
@@ -158,9 +158,8 @@ namespace WebWindowComplex.Models
// Inserisco nelle aree Splitted Fill e la struttura precedente (e setto ParentArea del fill)
ContentArea[0].SetParentArea(newSplittedList[1]);
newSplittedList[0].AreaList.Add(ContentArea[0]);
if (ContentArea[0] is Fill)
if (ContentArea[0] is Fill fill1)
{
Fill fill1 = (Fill)ContentArea[0];
Fill fill2 = Fill.CreateFill(newSplittedList[0], fill1.FillType);
newSplittedList[1].AreaList.Add(fill2);
}
@@ -310,9 +309,8 @@ namespace WebWindowComplex.Models
public void UpdateDimSubArea(Area area, double dim, string nameDim)
{
if (area is Sash && nameDim.Equals("Width"))
if (area is Sash sash && nameDim.Equals("Width"))
{
Sash sash = (Sash)area;
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();
@@ -384,9 +382,8 @@ namespace WebWindowComplex.Models
}
}
}
else if (area is Split)
else if (area is Split split)
{
Split split = (Split)area;
List<SplitDimension> splitList = new List<SplitDimension>();
double sum = 0;
if (nameDim.Equals("Width"))
@@ -526,9 +523,8 @@ namespace WebWindowComplex.Models
if (area.Equals(this))
return width;
Area item = area.AreaList[i];
if (area is Split)
if (area is Split split)
{
Split split = (Split)area;
if (split.SplitVertList.Count > 0)
{
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
@@ -557,9 +553,8 @@ namespace WebWindowComplex.Models
if (risultato != -1)
return risultato;
}
else if (area is Sash)
else if (area is Sash sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
@@ -606,9 +601,8 @@ namespace WebWindowComplex.Models
if (area.Equals(this))
return height;
Area item = area.AreaList[i];
if (area is Split)
if (area is Split split)
{
Split split = (Split)area;
if (split.SplitHorizList.Count > 0)
{
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
@@ -637,9 +631,8 @@ namespace WebWindowComplex.Models
if (risultato != -1)
return risultato;
}
else if (area is Sash)
else if (area is Sash sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
+2 -4
View File
@@ -251,14 +251,12 @@ namespace WebWindowComplex.Models
{
//return Double.Round(dDimension, 2);
double overlapElem = 0;
if (m_Parent is Sash)
if (m_Parent is Sash s)
{
// Calcolo overlap
Sash s = (Sash)m_Parent;
int indexSash = -1;
if (this is SashDimension)
if (this is SashDimension sashDimCurr)
{
SashDimension sashDimCurr = (SashDimension)this;
indexSash = s.SashList.IndexOf(sashDimCurr);
}
else
+13 -15
View File
@@ -34,21 +34,20 @@ namespace WebWindowComplex.Models
{
if(dDimension != value)
{
if (m_ParentArea is Split)
if (m_ParentArea is Split split)
{
if (value > m_dMax)
value = m_dMax;
else if (value < m_dMin)
value = m_dMin;
Split s = (Split)m_ParentArea;
SplitElementDimension splitElem = (SplitElementDimension)this;
List<SplitDimension> elemList = new List<SplitDimension>();
Frame? frame = s.ParentWindow.AreaList.First();
Frame? frame = split.ParentWindow.AreaList.First();
double dimTot = 0;
if (s.ElemDimVertList.Contains(splitElem))
elemList = s.SplitVertList;
else if (s.ElemDimHorizList.Contains(splitElem))
elemList = s.SplitHorizList;
if (split.ElemDimVertList.Contains(splitElem))
elemList = split.SplitVertList;
else if (split.ElemDimHorizList.Contains(splitElem))
elemList = split.SplitHorizList;
if(elemList.ElementAt(m_nIndex).MeasureType is MeasureTypes.ABSOLUTE ||
elemList.ElementAt(m_nIndex - 1).MeasureType is MeasureTypes.ABSOLUTE)
{
@@ -67,35 +66,34 @@ namespace WebWindowComplex.Models
elemList.ElementAt(m_nIndex).SetDimension(elemList.ElementAt(m_nIndex).dDimension + diff);
}
}
else if(m_ParentArea is Sash && (m_nIndex == 2 || m_nIndex == 4))
else if(m_ParentArea is Sash sash && (m_nIndex == 2 || m_nIndex == 4))
{
if (value > m_dMax)
value = m_dMax;
else if (value < m_dMin)
value = m_dMin;
Sash s = (Sash)m_ParentArea;
if (s.bIsDimensionLight)
if (sash.bIsDimensionLight)
{
int indSash = -1;
for(int i = 0; i < s.SashList.Count; i++)
for(int i = 0; i < sash.SashList.Count; i++)
{
if (s.SashList.ElementAt(i).ElementDimensionList.Contains(this))
if (sash.SashList.ElementAt(i).ElementDimensionList.Contains(this))
{
indSash = i;
break;
}
}
if(s.SashList.ElementAt(indSash).MeasureType is MeasureTypes.ABSOLUTE)
if(sash.SashList.ElementAt(indSash).MeasureType is MeasureTypes.ABSOLUTE)
{
if (value > m_dDimension)
{
double diff = (value - m_dDimension);
s.SashList.ElementAt(indSash).SetDimension(s.SashList.ElementAt(indSash).dDimension - diff);
sash.SashList.ElementAt(indSash).SetDimension(sash.SashList.ElementAt(indSash).dDimension - diff);
}
else
{
double diff = m_dDimension - value;
s.SashList.ElementAt(indSash).SetDimension(s.SashList.ElementAt(indSash).dDimension + diff);
sash.SashList.ElementAt(indSash).SetDimension(sash.SashList.ElementAt(indSash).dDimension + diff);
}
}
}
+2 -3
View File
@@ -456,10 +456,9 @@ namespace WebWindowComplex.Models
if(AreaList.First() is Sash)
overlap = ElementDimensionList.ElementAt(1).dOverlap +
ElementDimensionList.Last().dOverlap;
if (AreaList.First() is Split)
if (AreaList.First() is Split split)
{
Split s = (Split)AreaList.First();
if(s.SplitHorizList.Count > 0)
if(split.SplitHorizList.Count > 0)
overlap = ElementDimensionList.ElementAt(1).dOverlap +
ElementDimensionList.Last().dOverlap;
}
+5 -9
View File
@@ -1097,9 +1097,8 @@ namespace WebWindowComplex.Models
return res;
}
Area item = area.AreaList[i];
if (area is Split)
if (area is Split split)
{
Split split = (Split)area;
if (split.SplitVertList.Count > 0)
{
double dim = width;
@@ -1136,9 +1135,8 @@ namespace WebWindowComplex.Models
break;
}
}
if (split.ParentArea is Frame && split.AreaList.ElementAt(i).AreaList.First() is Sash)
if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash)
{
Frame frame = (Frame)split.ParentArea;
string overlapName = string.Join("_", split.ElemDimVertList.First().sName.Split('_').Skip(1)) + "_Top_Overlap";
if (i == 0)
{
@@ -1167,9 +1165,8 @@ namespace WebWindowComplex.Models
return res;
}
}
else if (area is Sash)
else if (area is Sash sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
@@ -1198,10 +1195,9 @@ namespace WebWindowComplex.Models
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else if (area is Frame)
else if (area is Frame frame)
{
Frame f = (Frame)area;
res = CalculateWidthSashGroup(item, f.AvailWidthArea(), res);
res = CalculateWidthSashGroup(item, frame.AvailWidthArea(), res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
+7 -12
View File
@@ -321,9 +321,8 @@ namespace WebWindowComplex.Models
return res;
}
Area item = area.AreaList[i];
if (area is Split)
if (area is Split split)
{
Split split = (Split)area;
if(split.SplitVertList.Count > 0)
{
int index = i;
@@ -363,9 +362,8 @@ namespace WebWindowComplex.Models
return res;
}
}
else if (area is Sash)
else if (area is Sash sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
@@ -458,9 +456,8 @@ namespace WebWindowComplex.Models
return res;
}
Area item = area.AreaList[i];
if (area is Split)
if (area is Split split)
{
Split split = (Split)area;
if (split.SplitHorizList.Count > 0)
{
double dim = height;
@@ -501,9 +498,8 @@ namespace WebWindowComplex.Models
break;
}
}
if (split.ParentArea is Frame && split.AreaList.ElementAt(i).AreaList.First() is Sash)
if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash)
{
Frame frame = (Frame)split.ParentArea;
string pos = i == 0 ? "_Top_Overlap" : "_Bottom_Overlap";
string overlapName = string.Join("_", split.ElemDimHorizList.First().sName.Split('_').Skip(1));
if (i == 0)
@@ -533,11 +529,10 @@ namespace WebWindowComplex.Models
return res;
}
}
else if (area is Sash)
else if (area is Sash sash)
{
Sash s = (Sash)area;
double dim = height - s.SashList.First().ElementDimensionList.First().dDimension
- s.SashList.First().ElementDimensionList.ElementAt(s.SashList.First().ElementDimensionList.Count - 2).dDimension;
double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension
- sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension;
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;