diff --git a/WebWindowComplex/Models/AreaDimension.cs b/WebWindowComplex/Models/AreaDimension.cs index f289578..bd7505a 100644 --- a/WebWindowComplex/Models/AreaDimension.cs +++ b/WebWindowComplex/Models/AreaDimension.cs @@ -128,10 +128,11 @@ namespace WebWindowComplex.Models //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1); return (dDimension / dimTot) * 100; } - else - { - return Double.Round(CalculatePropVal(itemList, indexSash, dimTot)); - } + return -1; + //else + //{ + // return Double.Round(CalculatePropVal(itemList, indexSash, dimTot)); + //} } case MeasureTypes.PROPORTIONAL: { @@ -153,10 +154,11 @@ namespace WebWindowComplex.Models //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2); return (dDimension * dimTot) / 100; } - else - { - return Double.Round(CalculatePropVal(itemList, indexSash, dimTot)); - } + return -1; + //else + //{ + // return Double.Round(CalculatePropVal(itemList, indexSash, dimTot)); + //} } } return -1; @@ -188,11 +190,13 @@ namespace WebWindowComplex.Models /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno /// /// - internal double CalculatePropVal(List itemList, int indexArea, double widthTot) + internal List CalculatePropVal(List itemList, int indexArea, double widthTot) { + List ans = itemList; if (itemList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) { - return 1; + ans.ElementAt(indexArea).SetDimension(1); + return ans; } List absoluteValue = new List(); foreach (var item in itemList) @@ -217,20 +221,20 @@ namespace WebWindowComplex.Models if (absoluteValue.ElementAt(indexArea) <= absoluteValue.ElementAt(i)) { var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i)); - itemList.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd); - itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd); + ans.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd); + ans.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd); } else { var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i)); - itemList.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd); - itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd); + ans.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd); + ans.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd); } break; } } } - return itemList.ElementAt(indexArea).dDimension; + return ans; } /// diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 68d5924..d422fb4 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -1241,7 +1241,8 @@ namespace WebWindowComplex.Models { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - foreach (var elem in split.ElemDimHorizList) + int minSubArea = split.ElemDimHorizList.Min(x=>x.nSubArea); + foreach (var elem in split.ElemDimHorizList.Where(x=>x.nSubArea == minSubArea)) { widthGlass = widthGlass - elem.dDimension; } @@ -1250,7 +1251,8 @@ namespace WebWindowComplex.Models } case MeasureTypes.PERCENTAGE: { - foreach (var elem in split.ElemDimHorizList) + int minSubArea = split.ElemDimHorizList.Min(x => x.nSubArea); + foreach (var elem in split.ElemDimHorizList.Where(x => x.nSubArea == minSubArea)) { dim = dim - elem.dDimension; } diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 0b61be0..3068065 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -46,13 +46,15 @@ namespace WebWindowComplex.Models double dimensionTot = 0; List dimensions = new List(); Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault() ?? new Frame(null, Parent.ParentWindow); + int subAreaVert = m_Parent.ElemDimVertList.Min(x => x.nSubArea); + int subAreaHoriz = m_Parent.ElemDimHorizList.Min(x => x.nSubArea); double width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; - foreach (var item in m_Parent.ElemDimVertList) + foreach (var item in m_Parent.ElemDimVertList.Where(x=>x.nSubArea == subAreaVert)) { width = width - item.dDimension; } double height = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; - foreach (var item in m_Parent.ElemDimHorizList) + foreach (var item in m_Parent.ElemDimHorizList.Where(x => x.nSubArea == subAreaHoriz)) { height = height - item.dDimension; } @@ -308,7 +310,14 @@ namespace WebWindowComplex.Models { dimSplitGroup = dimSplitGroup - item.dDimension; } - m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, dimSplitGroup, splitList.IndexOf(this)); + if (newType is MeasureTypes.PROPORTIONAL) + { + adList = ad.CalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup); + for (int i = 0; i < adList.Count; i++) + splitList.ElementAt(i).SetDimension(adList.ElementAt(i).dDimension); + } + else + m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, dimSplitGroup, splitList.IndexOf(this)); m_SelMeasureType = (MeasureTypes)value; } } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 528bfa1..0a73b47 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.515 + 3.1.3.517 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -281,6 +281,10 @@ + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index f58d06c..1369e15 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.515 + 3.1.3.517 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -227,6 +227,12 @@ + + + + + +