Modificato aggiornamento dimensioni sottoaree
This commit is contained in:
@@ -335,6 +335,28 @@ namespace WebWindowComplex.Models
|
||||
if (countAbsolute == sash.SashList.Count)
|
||||
{
|
||||
double sum = sash.SashList.Sum(x => x.dDimension);
|
||||
if (sash.ParentArea is Frame)
|
||||
{
|
||||
Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap
|
||||
+ frame.ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
else if (sash.ParentArea.ParentArea is Split && split.SplitVertList.Count > 0)
|
||||
{
|
||||
Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault();
|
||||
int indexSplit = sash.ParentArea.ParentArea.AreaList.IndexOf(sash.ParentArea) == 0 ? 0 : sash.ParentArea.ParentArea.AreaList.IndexOf(sash.ParentArea) - 1;
|
||||
string nameProfile = "";
|
||||
if (split.ElemDimVertList.ElementAt(indexSplit).sName == "" ||
|
||||
string.Join("_", split.ElemDimVertList.ElementAt(indexSplit).sName.Split('_').Skip(1)).Equals("Mixed_Split"))
|
||||
nameProfile = "Mixed_Split_Top";
|
||||
else
|
||||
nameProfile = string.Join("_", split.ElemDimVertList.ElementAt(indexSplit).sName.Split('_').Skip(1));
|
||||
string overlapName = nameProfile + "_Overlap";
|
||||
if (frame != null)
|
||||
dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName)
|
||||
+ frame.ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
if (sash.bIsDimensionLight)
|
||||
{
|
||||
dim = dim - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
|
||||
@@ -346,27 +368,10 @@ namespace WebWindowComplex.Models
|
||||
+ sash.SashList[i].ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i < sash.SashList.Count; i++)
|
||||
dim = dim + sash.SashList[i].ElementDimensionList.Last().dOverlap
|
||||
+ sash.SashList.First().ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
double res = dim - sum;
|
||||
if (res > 0)
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else if (res < 0)
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else if (countAbsolute < sash.SashList.Count && countPercentage != sash.SashList.Count && countProportional != sash.SashList.Count)
|
||||
@@ -404,20 +409,9 @@ namespace WebWindowComplex.Models
|
||||
sum = sum + splitList.Sum(x => x.dDimension);
|
||||
double res = 0;
|
||||
res = dim - sum;
|
||||
if (res > 0)
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if(dDimension != value)
|
||||
{
|
||||
double dimensioneOld = m_dDimension;
|
||||
if (value > m_dMax)
|
||||
m_dDimension = m_dMax;
|
||||
else if (value < m_dMin)
|
||||
@@ -53,15 +54,15 @@ namespace WebWindowComplex.Models
|
||||
if(elemList.ElementAt(m_nIndex).MeasureType is MeasureTypes.ABSOLUTE ||
|
||||
elemList.ElementAt(m_nIndex - 1).MeasureType is MeasureTypes.ABSOLUTE)
|
||||
{
|
||||
if (value > m_dDimension)
|
||||
if (value > dimensioneOld)
|
||||
{
|
||||
dimTot = dimTot - (value - m_dDimension);
|
||||
dimTot = dimTot - (value - dimensioneOld);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimTot = dimTot + (m_dDimension - value);
|
||||
dimTot = dimTot + (dimensioneOld - value);
|
||||
}
|
||||
double diff = (m_dDimension - value)/2;
|
||||
double diff = (dimensioneOld - value)/2;
|
||||
if(elemList.ElementAt(m_nIndex - 1).MeasureType is MeasureTypes.ABSOLUTE)
|
||||
elemList.ElementAt(m_nIndex - 1).SetDimension(elemList.ElementAt(m_nIndex - 1).dDimension + diff);
|
||||
if(elemList.ElementAt(m_nIndex).MeasureType is MeasureTypes.ABSOLUTE)
|
||||
@@ -69,18 +70,38 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
if (split.SplitHorizList.Count > 0)
|
||||
{
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in split.SplitHorizList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double height = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea());
|
||||
for (int i = 0; i < split.AreaList.Count; i++)
|
||||
{
|
||||
if (i < split.SplitHorizList.Count)
|
||||
split.AreaList.ElementAt(i).SearchAreaList(split.AreaList.ElementAt(i), split.SplitHorizList.ElementAt(i).dDimension, "Width");
|
||||
{
|
||||
SplitDimension currSplitDim = split.SplitHorizList[i];
|
||||
double dim = currSplitDim.dDimension;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1, 0);
|
||||
split.AreaList.ElementAt(i).SearchAreaList(split.AreaList.ElementAt(i), dim, "Height");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in split.SplitVertList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
for (int i = 0; i < split.AreaList.Count; i++)
|
||||
{
|
||||
if (i < split.SplitVertList.Count)
|
||||
split.AreaList.ElementAt(i).SearchAreaList(split.AreaList.ElementAt(i), split.SplitVertList.ElementAt(i).dDimension, "Height");
|
||||
{
|
||||
SplitDimension currSplitDim = split.SplitVertList[i];
|
||||
double dim = currSplitDim.dDimension;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1, 0);
|
||||
split.AreaList.ElementAt(i).SearchAreaList(split.AreaList.ElementAt(i), dim, "Width");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,14 +122,14 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
if(sash.SashList.ElementAt(indSash).MeasureType is MeasureTypes.ABSOLUTE)
|
||||
{
|
||||
if (value > m_dDimension)
|
||||
if (value > dimensioneOld)
|
||||
{
|
||||
double diff = (value - m_dDimension);
|
||||
double diff = (value - dimensioneOld);
|
||||
sash.SashList.ElementAt(indSash).SetDimension(sash.SashList.ElementAt(indSash).dDimension - diff);
|
||||
}
|
||||
else
|
||||
{
|
||||
double diff = m_dDimension - value;
|
||||
double diff = dimensioneOld - value;
|
||||
sash.SashList.ElementAt(indSash).SetDimension(sash.SashList.ElementAt(indSash).dDimension + diff);
|
||||
}
|
||||
for (int i = 0; i < sash.AreaList.Count; i++)
|
||||
@@ -173,6 +194,22 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public double dMaxDim
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dMax;
|
||||
}
|
||||
}
|
||||
|
||||
public double dMinDim
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dMin;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -1137,21 +1137,25 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash)
|
||||
{
|
||||
string overlapName = string.Join("_", split.ElemDimVertList.First().sName.Split('_').Skip(1)) + "_Top_Overlap";
|
||||
string overlapName = string.Join("_", split.ElemDimVertList.First().sName.Split('_').Skip(1));
|
||||
if (overlapName.Equals("Mixed_Split"))
|
||||
overlapName = overlapName + "_Top_Overlap";
|
||||
else
|
||||
overlapName = overlapName + "_Overlap";
|
||||
if (i == 0)
|
||||
{
|
||||
dim = dim + frame.ElementDimensionList.Last().dOverlap
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
}
|
||||
else if (i == split.SplitVertList.Count - 1)
|
||||
{
|
||||
dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
}
|
||||
else
|
||||
{
|
||||
dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName)
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
}
|
||||
}
|
||||
res = CalculateWidthSashGroup(item, dim, res);
|
||||
|
||||
@@ -327,7 +327,27 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
foreach(var item in m_Parent.AreaList)
|
||||
item.SearchAreaList(item, dDimension, "Width");
|
||||
{
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in Parent.SashList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double dim = dDimension;
|
||||
if (!(MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
{
|
||||
double width = Parent.CalculateWidthArea(frame, frame.AvailWidthArea());
|
||||
dim = ConvertDimension(dimList, MeasureType, MeasureTypes.ABSOLUTE, width, -1, 0);
|
||||
}
|
||||
if (item.AreaList.First() is Split s)
|
||||
{
|
||||
if (s.SplitVertList.Count > 0)
|
||||
{
|
||||
int indexSash = m_Parent.AreaList.IndexOf(item);
|
||||
dim = dim - Parent.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(1).dDimension
|
||||
- Parent.SashList.ElementAt(indexSash).ElementDimensionList.Last().dDimension;
|
||||
}
|
||||
}
|
||||
item.SearchAreaList(item, dim, "Width");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,22 +205,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SplitHorizList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if (i < SplitHorizList.Count)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitHorizList.ElementAt(i).dDimension, "Width");
|
||||
}
|
||||
}
|
||||
if (SplitVertList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if (i < SplitVertList.Count)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitVertList.ElementAt(i).dDimension, "Height");
|
||||
}
|
||||
}
|
||||
//UpdateSubAreaSplit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,22 +356,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
if(SplitHorizList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if(i < SplitHorizList.Count)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitHorizList.ElementAt(i).dDimension, "Width");
|
||||
}
|
||||
}
|
||||
if (SplitVertList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if(i < SplitVertList.Count)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitVertList.ElementAt(i).dDimension, "Height");
|
||||
}
|
||||
}
|
||||
//UpdateSubAreaSplit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -438,6 +408,7 @@ namespace WebWindowComplex.Models
|
||||
AreaList[SplitIndex].AreaList.Add(newFill);
|
||||
}
|
||||
}
|
||||
//UpdateSubAreaSplit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,6 +733,56 @@ namespace WebWindowComplex.Models
|
||||
return dim;
|
||||
}
|
||||
|
||||
internal void UpdateSubAreaSplit()
|
||||
{
|
||||
if (SplitHorizList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if (i < SplitHorizList.Count)
|
||||
{
|
||||
SplitDimension currSplitDim = SplitHorizList[i];
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in SplitHorizList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width");
|
||||
double dim = currSplitDim.dDimension;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
{
|
||||
double height = ParentArea.CalculateHeightArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea());
|
||||
foreach (var elem in ElemDimHorizList)
|
||||
height = height - elem.dDimension;
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1, 0);
|
||||
}
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), dim, "Height");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SplitVertList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if (i < SplitVertList.Count)
|
||||
{
|
||||
SplitDimension currSplitDim = SplitVertList[i];
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in SplitVertList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double dim = currSplitDim.dDimension;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
{
|
||||
double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
foreach (var elem in ElemDimVertList)
|
||||
width = width - elem.dDimension;
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1, 0);
|
||||
}
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), dim, "Width");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -51,17 +51,27 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
double dimensionTot = 0;
|
||||
List<SplitDimension> dimensions = new List<SplitDimension>();
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault()?? new Frame(null, Parent.ParentWindow);
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault() ?? new Frame(null, Parent.ParentWindow);
|
||||
double width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimVertList)
|
||||
{
|
||||
width = width - item.dDimension;
|
||||
}
|
||||
double height = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimHorizList)
|
||||
{
|
||||
height = height - item.dDimension;
|
||||
}
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
dimensions = m_Parent.SplitVertList;
|
||||
dimensionTot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
dimensionTot = width;
|
||||
}
|
||||
else
|
||||
{
|
||||
dimensions = m_Parent.SplitHorizList;
|
||||
//dimensionTot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimensionTot = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimensionTot = height;
|
||||
|
||||
}
|
||||
double valMinAbsolute = 100;
|
||||
double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1);
|
||||
@@ -221,9 +231,27 @@ namespace WebWindowComplex.Models
|
||||
for (int i = 0; i < m_Parent.AreaList.Count; i++)
|
||||
{
|
||||
if (m_Parent.SplitHorizList.Count > 0 && i < m_Parent.SplitHorizList.Count)
|
||||
m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), m_Parent.SplitHorizList.ElementAt(i).dDimension, "Height");
|
||||
{
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in m_Parent.SplitHorizList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
SplitDimension currSplitDim = m_Parent.SplitHorizList[i];
|
||||
double dim = currSplitDim.dDimension;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1, 0);
|
||||
m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), dim, "Height");
|
||||
}
|
||||
if (m_Parent.SplitVertList.Count > 0 && i < m_Parent.SplitVertList.Count)
|
||||
m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), m_Parent.SplitVertList.ElementAt(i).dDimension, "Width");
|
||||
{
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in m_Parent.SplitVertList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
SplitDimension currSplitDim = m_Parent.SplitVertList[i];
|
||||
double dim = currSplitDim.dDimension;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1, 0);
|
||||
m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), dim, "Width");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user