diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 4b25dcc..11f04c5 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -266,7 +266,7 @@ namespace Test.UI.Components.Pages {"Sash_Active_Overlap", 26}, {"Sash_Inactive_Overlap", 26}, {"Sash_BottomRail_Overlap", 24.5}, - {"Sash_Bottom_Overlap", 18}, + {"Sash_Bottom_Overlap", 26}, {"Sash_Horizontal_Bottom_Overlap", 26}, {"Sash_Horizontal_Top_Overlap", 41}, {"Sash_Threshold_Overlap", 18}, diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 6a67c88..09506c1 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -119,12 +119,6 @@ - @*
- -
-
- -
*@ } diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index 6af9e61..c67171f 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -317,7 +317,7 @@ namespace WebWindowComplex.Compo private string EditDimensionCss() { - if(CurrFrameWindow.DimensionList.Count == 2) + if(CurrFrameWindow.DimensionList.Count % 2 == 0) return "col-md-12 col-lg-6"; else return "col-md-12 col-lg-4"; diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index e9a056e..392d273 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -212,7 +212,7 @@ namespace WebWindowComplex.Compo .ToList(); foreach (var item in ElemIndexList) { - item.dDimension = updRec.dDimension; + item.SetDimension(updRec.dDimension); } } else diff --git a/WebWindowComplex/Compo/EditElement.razor b/WebWindowComplex/Compo/EditElement.razor index bf5d823..8c97a1e 100644 --- a/WebWindowComplex/Compo/EditElement.razor +++ b/WebWindowComplex/Compo/EditElement.razor @@ -3,10 +3,10 @@ @(name()) @if (User) { - + } else { - + } \ No newline at end of file diff --git a/WebWindowComplex/Compo/EditElement.razor.cs b/WebWindowComplex/Compo/EditElement.razor.cs index 971665d..448b2bb 100644 --- a/WebWindowComplex/Compo/EditElement.razor.cs +++ b/WebWindowComplex/Compo/EditElement.razor.cs @@ -150,6 +150,11 @@ namespace WebWindowComplex.Compo } } + private string Title() + { + return "Max: " + CurrRec.dMaxDim + ", Min: " + CurrRec.dMinDim; + } + #endregion Private Properties } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/EditSplitElement.razor b/WebWindowComplex/Compo/EditSplitElement.razor index 2b7c6fa..f42a7cd 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor +++ b/WebWindowComplex/Compo/EditSplitElement.razor @@ -3,10 +3,10 @@ @CurrRec.nIndex @if (User) { - + } else { - + } \ No newline at end of file diff --git a/WebWindowComplex/Compo/EditSplitElement.razor.cs b/WebWindowComplex/Compo/EditSplitElement.razor.cs index 8256c5d..fb32c8b 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor.cs +++ b/WebWindowComplex/Compo/EditSplitElement.razor.cs @@ -43,6 +43,11 @@ namespace WebWindowComplex.Compo } } + private string Title() + { + return "Max: " + CurrRec.dMaxDim + ", Min: " + CurrRec.dMinDim; + } + //private string name() //{ // string ans = ""; diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 6db6e65..6d3d54e 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -171,6 +171,12 @@ namespace WebWindowComplex.Models // All'area Split aggiunto le due aree Splitted for (int i = 0; i < 2; i++) AreaList[0].AreaList.Add(newSplittedList[i]); + Frame frame = ParentWindow.AreaList.First(); + if(frame != null) + { + frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width"); + frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); + } } public void AddInglesina() @@ -271,10 +277,31 @@ namespace WebWindowComplex.Models List dimList = new List(); foreach (var item in s.SashList) dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); - if(nameDim.Equals("Width")) - SearchAreaList(node.AreaList.ElementAt(i), s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim); - else + if (nameDim.Equals("Width") && s.SashList.First().ElementDimensionList.Count > 0) + { + double widthSash = dim + s.SashList.First().ElementDimensionList.Last().dOverlap + + s.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap; + double widthAnta = s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, widthSash); + 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; + SearchAreaList(node.AreaList.ElementAt(i), widthAnta, nameDim); + } + else if(s.SashList.First().ElementDimensionList.Count > 0) + { + if(s.ParentArea is Split split && split.SplitHorizList.Count > 0) + dim = dim + 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) + { + foreach (var bottomRail in s.BottomRailElemDimList) + dim = dim - bottomRail.dDimension + + bottomRail.dOverlap; + } + dim = dim - s.SashList.ElementAt(i).ElementDimensionList.First().dDimension + - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension; SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); + } } else if (node.AreaType.Equals(AreaTypes.SPLIT)) { @@ -284,8 +311,14 @@ namespace WebWindowComplex.Models { foreach (var item in s.SplitHorizList) dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); - if(nameDim.Equals("Width")) - SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); + if (nameDim.Equals("Width")) + { + double widthTot = dim; + if(s.AreaList.ElementAt(i).AreaList.First() is Sash sash && sash != null) + widthTot = widthTot + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap + + sash.SashList.First().ElementDimensionList.Last().dOverlap; + SearchAreaList(node.AreaList.ElementAt(i), widthTot, nameDim); + } else SearchAreaList(node.AreaList.ElementAt(i), s.SplitHorizList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim); } @@ -293,8 +326,13 @@ namespace WebWindowComplex.Models { foreach (var item in s.SplitVertList) dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); - if(nameDim.Equals("Width")) - SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim); + if (nameDim.Equals("Width")) + { + double width = dim; + foreach (var elem in s.ElemDimVertList) + width = width - elem.dDimension; + SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, width), nameDim); + } else SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); } @@ -335,31 +373,21 @@ namespace WebWindowComplex.Models if (countAbsolute == sash.SashList.Count) { double sum = sash.SashList.Sum(x => x.dDimension); - if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0)) + if ((sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0)) { //Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault(); //if (frame != null) // dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap // + frame.ElementDimensionList.Last().dOverlap; - if(sash.SashList.Count == 1) - dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap; + //if(sash.SashList.Count == 1) + // dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap; 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) { - 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; + dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap + + sash.SashList.First().ElementDimensionList.Last().dOverlap; } if (sash.bIsDimensionLight) { @@ -372,6 +400,13 @@ namespace WebWindowComplex.Models + sash.SashList[i].ElementDimensionList.Last().dOverlap; } } + else if (sash.SashList.Count > 1 && dim > sum) + { + 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) { @@ -394,28 +429,36 @@ namespace WebWindowComplex.Models else if (area is Split split) { List splitList = new List(); + List elemList = new List(); double sum = 0; if (nameDim.Equals("Width")) { splitList = split.SplitVertList; - foreach (var item in split.ElemDimVertList) - sum = sum + item.dDimension; + elemList = split.ElemDimVertList; + //foreach (var item in split.ElemDimVertList) + // sum = sum + item.dDimension; } else { splitList = split.SplitHorizList; - foreach (var item in split.ElemDimHorizList) - sum = sum + item.dDimension; + elemList = split.ElemDimHorizList; + //foreach (var item in split.ElemDimHorizList) + // sum = sum + item.dDimension; } int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count(); if (countAbsolute != 0 && countAbsolute == splitList.Count) { sum = sum + splitList.Sum(x => x.dDimension); - double res = 0; - res = dim - sum; + List dimensionList = new List(); + 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) { - item.SetDimension(item.dDimension + res / countAbsolute); + double widthPerc = item.ConvertDimension(dimensionList, item.MeasureType, MeasureTypes.PERCENTAGE, sum, splitList.IndexOf(item)); + item.SetDimension(widthGlass * widthPerc / 100); } } } diff --git a/WebWindowComplex/Models/AreaDimension.cs b/WebWindowComplex/Models/AreaDimension.cs index 475f122..aa86479 100644 --- a/WebWindowComplex/Models/AreaDimension.cs +++ b/WebWindowComplex/Models/AreaDimension.cs @@ -122,7 +122,7 @@ namespace WebWindowComplex.Models /// Vecchio tipo /// Nuovo tipo /// - public double ConvertDimension(List itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash, double overlap) + public double ConvertDimension(List itemList, MeasureTypes oldType, MeasureTypes newType, double dimTot, int indexSash) { switch (oldType) { @@ -131,11 +131,11 @@ namespace WebWindowComplex.Models if (newType.Equals(MeasureTypes.PERCENTAGE)) { //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1); - return (dDimension / widthTot) * 100; + return (dDimension / dimTot) * 100; } else { - return Double.Round(CalculatePropVal(itemList, indexSash, widthTot)); + return Double.Round(CalculatePropVal(itemList, indexSash, dimTot)); } } case MeasureTypes.PROPORTIONAL: @@ -143,12 +143,12 @@ namespace WebWindowComplex.Models if (newType.Equals(MeasureTypes.ABSOLUTE)) { //return Double.Round(ConvertFromPropVal(newType), 2); - return ConvertFromPropVal(itemList, newType, widthTot); + return ConvertFromPropVal(itemList, newType, dimTot); } else { //return Double.Round(ConvertFromPropVal(newType), 1); - return ConvertFromPropVal(itemList, newType, widthTot); + return ConvertFromPropVal(itemList, newType, dimTot); } } case MeasureTypes.PERCENTAGE: @@ -156,11 +156,11 @@ namespace WebWindowComplex.Models if (newType.Equals(MeasureTypes.ABSOLUTE)) { //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2); - return (dDimension * widthTot) / 100; + return (dDimension * dimTot) / 100; } else { - return Double.Round(CalculatePropVal(itemList, indexSash, widthTot)); + return Double.Round(CalculatePropVal(itemList, indexSash, dimTot)); } } } @@ -263,7 +263,12 @@ namespace WebWindowComplex.Models indexSash = itemList.IndexOf(this); int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1; if (!s.bIsDimensionLight && s.SashList.ElementAt(indexSash).ElementDimensionList.Count > 0) - overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + { + if(s.SashList.Count > 0) + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + else + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap; + } } return dDimension; } diff --git a/WebWindowComplex/Models/ElementDimension.cs b/WebWindowComplex/Models/ElementDimension.cs index e1fa155..392b3be 100644 --- a/WebWindowComplex/Models/ElementDimension.cs +++ b/WebWindowComplex/Models/ElementDimension.cs @@ -54,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 > dimensioneOld) + if (m_dDimension > dimensioneOld) { - dimTot = dimTot - (value - dimensioneOld); + dimTot = dimTot - (m_dDimension - dimensioneOld); } else { - dimTot = dimTot + (dimensioneOld - value); + dimTot = dimTot + (dimensioneOld - m_dDimension); } - double diff = (dimensioneOld - value)/2; + double diff = (dimensioneOld - m_dDimension) /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) @@ -74,6 +74,9 @@ namespace WebWindowComplex.Models 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()); + List horizElemList = split.ElemDimHorizList.Where(x=>x.m_nIndex== 1).ToList(); + foreach (var elem in horizElemList) + height = height - elem.dDimension; for (int i = 0; i < split.AreaList.Count; i++) { if (i < split.SplitHorizList.Count) @@ -81,7 +84,7 @@ namespace WebWindowComplex.Models 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); + dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1); split.AreaList.ElementAt(i).SearchAreaList(split.AreaList.ElementAt(i), dim, "Height"); } } @@ -92,6 +95,9 @@ namespace WebWindowComplex.Models 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()); + List vertElemList = split.ElemDimVertList.Where(x => x.m_nIndex == 1).ToList(); + foreach (var elem in vertElemList) + width = width - elem.dDimension; for (int i = 0; i < split.AreaList.Count; i++) { if (i < split.SplitVertList.Count) @@ -99,7 +105,7 @@ namespace WebWindowComplex.Models 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); + dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1); split.AreaList.ElementAt(i).SearchAreaList(split.AreaList.ElementAt(i), dim, "Width"); } } @@ -122,18 +128,18 @@ namespace WebWindowComplex.Models } if(sash.SashList.ElementAt(indSash).MeasureType is MeasureTypes.ABSOLUTE) { - if (value > dimensioneOld) + if (m_dDimension > dimensioneOld) { - double diff = (value - dimensioneOld); + double diff = (m_dDimension - dimensioneOld); sash.SashList.ElementAt(indSash).SetDimension(sash.SashList.ElementAt(indSash).dDimension - diff); } else { - double diff = dimensioneOld - value; + double diff = dimensioneOld - m_dDimension; sash.SashList.ElementAt(indSash).SetDimension(sash.SashList.ElementAt(indSash).dDimension + diff); } - for (int i = 0; i < sash.AreaList.Count; i++) - sash.AreaList.ElementAt(i).SearchAreaList(sash.AreaList.ElementAt(i), sash.SashList.ElementAt(i).dDimension, "Width"); + for (int i = 0; i < sash.AreaList.Count; i++) + sash.AreaList.ElementAt(i).SearchAreaList(sash.AreaList.ElementAt(i), sash.SashList.ElementAt(i).dDimension, "Width"); } } } @@ -193,7 +199,6 @@ namespace WebWindowComplex.Models return m_dOverlap; } } - public double dMaxDim { get @@ -201,7 +206,6 @@ namespace WebWindowComplex.Models return m_dMax; } } - public double dMinDim { get @@ -250,6 +254,39 @@ namespace WebWindowComplex.Models return newElementDimension; } + public override bool Equals(object obj) + { + return Equals(obj as ElementDimension); + } + + public bool Equals(ElementDimension other) + { + if (other is null) + return false; + if (dDimension != other.dDimension) + return false; + if (dOverlap != other.dOverlap) + return false; + if (ParentArea != other.ParentArea) + return false; + if (nIndex != other.nIndex) + return false; + if (sName != other.sName) + return false; + if (dMaxDim != other.dMaxDim) + return false; + if (dMinDim != other.dMinDim) + return false; + if (ReferenceEquals(this, other)) + return true; + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + #endregion Public Methods #region Internal Methods diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index a99b89f..2507ee4 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -90,22 +90,22 @@ namespace WebWindowComplex.Models m_SelThreshold = newThreshold; else m_SelThreshold = new Threshold(3, "Bottom"); + string profileName = ""; if (m_SelThreshold.Name.Equals("Threshold")) - { - ElementDimensionList.First().SetNameElement("Frame_Sash_Threshold"); - ElementDimensionList.First().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(ElementDimensionList.First().sName + "_DimMin")); - ElementDimensionList.First().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(ElementDimensionList.First().sName + "_DimMax")); - ElementDimensionList.First().SetDimension(Window.m_ParameterList.GetValueOrDefault(ElementDimensionList.First().sName + "_DimStd")); - string overlapName = "Sash_Bottom_Overlap"; - ElementDimensionList.First().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName)); - } + profileName = "Frame_Sash_Threshold"; + else + profileName = "Frame_Sash_Bottom"; + ElementDimensionList.First().SetNameElement(profileName); + ElementDimensionList.First().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(profileName + "_DimMin")); + ElementDimensionList.First().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(profileName + "_DimMax")); + ElementDimensionList.First().SetDimension(Window.m_ParameterList.GetValueOrDefault(profileName + "_DimStd")); + string overlapName = "Sash_Bottom_Overlap"; + ElementDimensionList.First().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName)); if (AreaList.Count > 0) { SearchAreaList(this, AvailWidthArea(), "Width"); SearchAreaList(this, AvailHeightArea(), "Height"); } - - //ElementDimensionList.Clear(); } } @@ -453,6 +453,11 @@ namespace WebWindowComplex.Models if (AreaList.First() is Sash) overlap = ElementDimensionList.First().dOverlap + ElementDimensionList.ElementAt(ElementDimensionList.Count() - 2).dOverlap; + if(BottomRailQty > 0) + { + foreach (var bottomRail in BottomRailElemDimList) + dim = dim - bottomRail.dDimension; + } return dim - ElementDimensionList.First().dDimension - ElementDimensionList.ElementAt(ElementDimensionList.Count() - 2).dDimension + overlap; @@ -476,12 +481,12 @@ namespace WebWindowComplex.Models if(AreaList.First() is Sash) overlap = ElementDimensionList.ElementAt(1).dOverlap + ElementDimensionList.Last().dOverlap; - if (AreaList.First() is Split split) - { - if(split.SplitHorizList.Count > 0) - overlap = ElementDimensionList.ElementAt(1).dOverlap + - ElementDimensionList.Last().dOverlap; - } + //if (AreaList.First() is Split split) + //{ + // if(split.SplitHorizList.Count > 0) + // overlap = ElementDimensionList.ElementAt(1).dOverlap + + // ElementDimensionList.Last().dOverlap; + //} return dim - ElementDimensionList.ElementAt(1).dDimension - ElementDimensionList.Last().dDimension + overlap; diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index f7b9ba8..5d522f7 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -345,14 +345,17 @@ namespace WebWindowComplex.Models { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete), SashList.Last().ElementDimensionList.Last().dOverlap); + deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete)); } else { deleteDim = itemDelete.dDimension; } dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension + splitDelete; - SashList[SashList.Count - 1].SetDimension(dLastDimension); + if(SashList[SashList.Count - 1].SelMeasureType is MeasureTypes.PROPORTIONAL && SashList.Count == 1) + SashList[SashList.Count - 1].SetDimension(1); + else + SashList[SashList.Count - 1].SetDimension(dLastDimension); if (value == 1) SashList.First().SetHasHandle(true); } @@ -430,7 +433,13 @@ namespace WebWindowComplex.Models } } for (int i = 0; i < AreaList.Count; i++) - AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SashList.ElementAt(i).dDimension, "Width"); + { + double width = SashList.ElementAt(i).dDimension; + if(SashList.ElementAt(i).ElementDimensionList.Count > 0) + width = width - SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width"); + } } RefreshHardwareList(); ClearHardwareOptionList(); @@ -484,6 +493,7 @@ namespace WebWindowComplex.Models BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); BottomRailElemDimList.Last().SetDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimStd")); + BottomRailElemDimList.Last().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault("Sash_BottomRail_Overlap")); if (value > 1 && BottomRailElemDimList.Count - 2 >= 0) { BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetNameElement("Sash_Rail"); @@ -514,6 +524,10 @@ namespace WebWindowComplex.Models { m_bSashBottomRail = false; } + Frame frame = ParentWindow.AreaList.First(); + if (frame.AreaList.Count > 0 && frame != null) + frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); + //ParentWindow.AreaList.First().SearchAreaList(ParentWindow.AreaList.First(), ParentWindow.AreaList.First().AvailHeightArea(), "Height"); } } } @@ -1135,36 +1149,22 @@ namespace WebWindowComplex.Models break; } } - 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)); - 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); - } - else if (i == split.SplitVertList.Count - 1) - { - dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap - + Window.m_ParameterList.GetValueOrDefault(overlapName); - } - else - { - dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName) - + Window.m_ParameterList.GetValueOrDefault(overlapName); - } - } + if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash) + dim = dim + sash.SashList.First().ElementDimensionList.Last().dOverlap + + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap; res = CalculateWidthSashGroup(item, dim, res); if (res.m_Dimension != -1 && res.m_Found) return res; } else { - res = CalculateWidthSashGroup(item, width, res); + double dim = width; + if(split.SplitHorizList.Count > 0 && split.AreaList.First().AreaList.First() is Sash sash) + { + dim = dim + sash.SashList.First().ElementDimensionList.Last().dOverlap + + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap; + } + res = CalculateWidthSashGroup(item, dim, res); if (res.m_Dimension != -1 && res.m_Found) return res; } @@ -1199,12 +1199,6 @@ namespace WebWindowComplex.Models if (res.m_Dimension != -1 && res.m_Found) return res; } - else if (area is Frame frame) - { - res = CalculateWidthSashGroup(item, frame.AvailWidthArea(), res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } else { res = CalculateWidthSashGroup(item, width, res); diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index b9a9d1b..4d936cd 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -289,12 +289,6 @@ namespace WebWindowComplex.Models break; } } - double overlapCurrSash = 0; - if (!Parent.bIsDimensionLight) - { - int j = nIndex == 0 ? 1 : Parent.SashList.ElementAt(nIndex).ElementDimensionList.Count - 1; - overlapCurrSash = Parent.SashList.ElementAt(nIndex).ElementDimensionList.ElementAt(j).dOverlap / 2; - } int indexDimChange = 0; // L'anta modificata non è l'ultima if (nIndex < absoluteValList.Count - 1) @@ -302,20 +296,14 @@ namespace WebWindowComplex.Models // L'anta modificata è l'ultima else if (dimensions.Count > 1) indexDimChange = nIndex - 1; - double overlap = 0; - if (!Parent.bIsDimensionLight) - { - int j = indexDimChange == 0 ? 1 : Parent.SashList.ElementAt(nIndex + 1).ElementDimensionList.Count - 1; - overlap = Parent.SashList.ElementAt(indexDimChange).ElementDimensionList.ElementAt(j).dOverlap / 2; - } if (value < m_dDimension) { - absoluteValList[indexDimChange] = absoluteValList[indexDimChange] + (absoluteValList[nIndex] - (valueInAbsolute - overlapCurrSash)) + overlap; + absoluteValList[indexDimChange] = absoluteValList[indexDimChange] + (absoluteValList[nIndex] - valueInAbsolute); absoluteValList[nIndex] = valueInAbsolute; } else { - absoluteValList[indexDimChange] = absoluteValList[indexDimChange] - ((valueInAbsolute - overlapCurrSash) - absoluteValList[nIndex]) + overlap; + absoluteValList[indexDimChange] = absoluteValList[indexDimChange] - (valueInAbsolute - absoluteValList[nIndex]); absoluteValList[nIndex] = valueInAbsolute; } if (MeasureType.Equals(MeasureTypes.PROPORTIONAL)) @@ -335,7 +323,7 @@ namespace WebWindowComplex.Models if (!(MeasureType.Equals(MeasureTypes.ABSOLUTE))) { double width = Parent.CalculateWidthArea(frame, frame.AvailWidthArea()); - dim = ConvertDimension(dimList, MeasureType, MeasureTypes.ABSOLUTE, width, -1, 0); + dim = ConvertDimension(dimList, MeasureType, MeasureTypes.ABSOLUTE, width, -1); } if (item.AreaList.First() is Split s) { @@ -449,15 +437,15 @@ namespace WebWindowComplex.Models adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent)); } double overlap = 0; - if (!Parent.bIsDimensionLight) - { - int index = m_Parent.SashList.IndexOf(this); - if (index == 0) - overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; - else - overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; - } - m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId - 1, overlap); + //if (!Parent.bIsDimensionLight) + //{ + // int index = m_Parent.SashList.IndexOf(this); + // if (index == 0) + // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; + // else + // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; + //} + m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId - 1); SelMeasureType = (MeasureTypes)value; } } @@ -560,27 +548,23 @@ namespace WebWindowComplex.Models } } AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); - //if(SelMeasureType is MeasureTypes.ABSOLUTE) - // ad = new AreaDimension(dDimension - ElementDimensionList.ElementAt(1).dOverlap, SelMeasureType); - //else - // ad = new AreaDimension(dDimension, SelMeasureType); List newDimensions = new List(); foreach(var item in m_Parent.SashList) { newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } int index = m_Parent.SashList.IndexOf(this); - double overlap = 0; - if (index == 0) - overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; - else - overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; - m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash, overlap); - if (newType is MeasureTypes.PROPORTIONAL) - { - for (int i = 0; i < newDimensions.Count; i++) - m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); - } + //double overlap = 0; + //if (index == 0) + // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; + //else + // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; + m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash); + //if (newType is MeasureTypes.PROPORTIONAL) + //{ + // for (int i = 0; i < newDimensions.Count; i++) + // m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); + //} SelMeasureType = (MeasureTypes)value; } } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 0344b15..3d8268f 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -753,7 +753,7 @@ namespace WebWindowComplex.Models 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); + dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1); } AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), dim, "Height"); } @@ -775,7 +775,7 @@ namespace WebWindowComplex.Models 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); + dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1); } AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), dim, "Width"); } diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 192d4eb..e9d7741 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -238,7 +238,7 @@ namespace WebWindowComplex.Models 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); + dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1); m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), dim, "Height"); } if (m_Parent.SplitVertList.Count > 0 && i < m_Parent.SplitVertList.Count) @@ -249,7 +249,7 @@ namespace WebWindowComplex.Models 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); + dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1); m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), dim, "Width"); } } @@ -310,7 +310,7 @@ namespace WebWindowComplex.Models { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this), 0); + m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this)); m_SelMeasureType = (MeasureTypes)value; } } @@ -354,6 +354,9 @@ namespace WebWindowComplex.Models if(split.SplitVertList.Count > 0) { int index = i; + double widthGlass = width; + foreach (var elem in split.ElemDimVertList) + widthGlass = widthGlass - elem.dDimension; if (split.SelSplitShape is SplitShapes.GRID) index = i % split.SplitHorizList.Count; switch (split.SplitVertList.ElementAt(index).SelMeasureType) @@ -371,12 +374,12 @@ namespace WebWindowComplex.Models { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); + res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass), res); break; } case MeasureTypes.PERCENTAGE: { - res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * width / 100, res); + res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * widthGlass / 100, res); break; } } @@ -392,16 +395,34 @@ namespace WebWindowComplex.Models } else if (area is Sash sash) { + 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; + if (sash.bIsDimensionLight) + { + 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; + } + } + else + { + for (int anta = 1; anta < sash.SashList.Count; anta++) + { + widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; + } + } switch (sash.SashList.ElementAt(i).SelMeasureType) { case MeasureTypes.ABSOLUTE: { - double dim = sash.SashList.ElementAt(i).dDimension; - if (!sash.bIsDimensionLight) - dim = dim - - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - res = CalculateWidthSplitGroup(item, dim, res); + dim = sash.SashList.ElementAt(i).dDimension; break; } case MeasureTypes.PROPORTIONAL: @@ -409,50 +430,20 @@ namespace WebWindowComplex.Models AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent); List adList = new List(); foreach (var it in sash.SashList) - { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - } - double widthTot = width; - int index = adList.IndexOf(ad) == 0 ? 1 : adList.Count - 1; ; - double dim = 0; - if (sash.bIsDimensionLight) - { - for (int anta = 0; anta < sash.SashList.Count; anta++) - { - if (anta == 0) - widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension; - else - widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension - + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; - } - dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot); - } - else - { - dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot) - + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(index).dOverlap / 2; - dim = dim - - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - } - res = CalculateWidthSplitGroup(item, dim, res); + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot); break; } case MeasureTypes.PERCENTAGE: { - double overlapElem = 0; - int indElem = i == 0 ? 1 : sash.SashList.ElementAt(i).ElementDimensionList.Count - 1; - if (!sash.bIsDimensionLight) - overlapElem = sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(indElem).dOverlap / 2; - double dim = sash.SashList.ElementAt(i).dDimension * width / 100 + overlapElem - - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - res = CalculateWidthSplitGroup(item, dim, res); + dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100; break; } } + if (!sash.bIsDimensionLight) + dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + res = CalculateWidthSplitGroup(item, dim, res); if (res.m_Dimension != -1 && res.m_Found) return res; } @@ -497,7 +488,6 @@ namespace WebWindowComplex.Models case MeasureTypes.ABSOLUTE: { dim = split.SplitHorizList.ElementAt(index).dDimension; - //res = CalculateHeightSplitGroup(item, heightItemGroup, res); break; } case MeasureTypes.PROPORTIONAL: @@ -506,15 +496,10 @@ namespace WebWindowComplex.Models AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent); List adList = new List(); foreach (var it in split.SplitHorizList) - { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - } foreach (var elem in split.ElemDimHorizList) - { heigthGlass = heigthGlass - elem.dDimension; - } dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, heigthGlass); - //res = CalculateHeightSplitGroup(item, heightItemGroup, res); break; } case MeasureTypes.PERCENTAGE: @@ -522,29 +507,13 @@ namespace WebWindowComplex.Models foreach(var elem in split.ElemDimHorizList) dim = dim - elem.dDimension; dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100; - //res = CalculateHeightSplitGroup(item, heightItemGroup, res); break; } } - if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash) + if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash) { - string pos = i == 0 ? "_Top_Overlap" : "_Bottom_Overlap"; - string overlapName = string.Join("_", split.ElemDimHorizList.First().sName.Split('_').Skip(1)); - if (i == 0) - { - dim = dim + frame.ElementDimensionList.First().dOverlap - + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Bottom_Overlap"); - } - else if (i == split.SplitHorizList.Count - 1) - { - dim = dim + frame.ElementDimensionList.ElementAt(frame.ElementDimensionList.Count - 2).dOverlap - + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Top_Overlap"); - } - else - { - dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Top_Overlap") - + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Bottom_Overlap"); - } + dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap + + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap; } res = CalculateHeightSplitGroup(item, dim, res); if (res.m_Dimension != -1 && res.m_Found) @@ -559,8 +528,23 @@ namespace WebWindowComplex.Models } else if (area is Sash sash) { + double overlap = 0; + double bottomRail = 0; + //if (sash.ParentArea is Split) + // overlap = sash.SashList.First().ElementDimensionList.First().dOverlap + // + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap; + //if (sash.ParentArea.ParentArea is Split) + // overlap = sash.SashList.First().ElementDimensionList.First().dOverlap + // + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap; + if(sash.SashBottomRailQty > 0) + { + foreach (var bottom in sash.BottomRailElemDimList) + bottomRail = bottomRail + bottom.dDimension + - bottom.dOverlap; + } double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension - - sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension; + - sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension + - bottomRail; res = CalculateHeightSplitGroup(item, dim, res); if (res.m_Dimension != -1 && res.m_Found) return res; @@ -618,28 +602,25 @@ namespace WebWindowComplex.Models { newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this), 0); - if (newType is MeasureTypes.PROPORTIONAL) - { - for (int i = 0; i < m_Parent.SplitVertList.Count; i++) - { - m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); - } - } + m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this)); + //if (newType is MeasureTypes.PROPORTIONAL) + //{ + // for (int i = 0; i < m_Parent.SplitVertList.Count; i++) + // { + // m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); + // } + //} } else { - //tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension; dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; List elemList = new List(); - if (Parent.bSplitStartVert || Parent.nSplitQtyVert == 0) + if (Parent.bSplitStartVert) { - for (int i = 0; i < m_Parent.ElemDimHorizList.Count; i++) - { - if( i == i + m_Parent.ElemDimVertList.Count * i && m_Parent.ElemDimHorizList.ElementAtOrDefault(i) != null) - elemList.Add(m_Parent.ElemDimHorizList.ElementAtOrDefault(i)!); - } + elemList = m_Parent.ElemDimHorizList.Where(x => x.nSubArea == 1).ToList(); } + else + elemList = m_Parent.ElemDimHorizList; foreach (var item in elemList) { dimSplitGroup = dimSplitGroup - item.dDimension; @@ -650,14 +631,14 @@ namespace WebWindowComplex.Models { newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this), 0); - if(newType is MeasureTypes.PROPORTIONAL) - { - for(int i = 0; i < m_Parent.SplitHorizList.Count; i++) - { - m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); - } - } + m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this)); + //if(newType is MeasureTypes.PROPORTIONAL) + //{ + // for(int i = 0; i < m_Parent.SplitHorizList.Count; i++) + // { + // m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); + // } + //} } m_SelMeasureType = (MeasureTypes)value; } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 2f4c36d..e2d6293 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components; using Newtonsoft.Json; using NLog; +using System.Collections.Generic; using System.Threading.Tasks; using WebWindowComplex.Compo; using WebWindowComplex.DTO; @@ -827,6 +828,7 @@ namespace WebWindowComplex } if (LiveData.ProfElementList.Count > 0) { + //List OrderedListProf = LiveData.ProfElementList.OrderBy(x => x.GroupId).ToList(); // Inserisco i profili ricevuti nei rispettivi Element foreach (var item in LiveData.ProfElementList) { @@ -834,7 +836,7 @@ namespace WebWindowComplex } } } - + /// /// Metodo che resetta le liste (sash, split, splitted, fill e itemTable) e le crea nuovamente /// @@ -1237,6 +1239,15 @@ namespace WebWindowComplex for (int index = profileNameList.Count; index < frame.ElementDimensionList.Count; index++) frame.ElementDimensionList.RemoveAt(index); elemList = frame.ElementDimensionList; + foreach (var item in elemList) + { + string overlapName = string.Join("_", item.sName.Split('_').Skip(1)); + item.SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName + "_Overlap")); + } + foreach (var elem in frame.BottomRailElemDimList) + { + elem.SetOverlapElement(Window.m_ParameterList.GetValueOrDefault("Frame_BottomRail_Overlap")); + } break; } case AreaTypes.SASH: @@ -1254,7 +1265,7 @@ namespace WebWindowComplex { anta.ElementDimensionList.ElementAt(i).SetNameElement(profileNameList.ElementAt(i)); } - elemList = anta.ElementDimensionList; + SetOverlapSash(sash, anta, EntityIdSearch - 1, elemList); break; } case AreaTypes.SPLIT: @@ -1267,12 +1278,28 @@ namespace WebWindowComplex SpElemList.ElementAt(i).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimMin")); SpElemList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimMax")); if (SpElemList.ElementAt(i).dDimension > SpElemList.ElementAt(i).dMaxDim) + { SpElemList.ElementAt(i).SetDimension(SpElemList.ElementAt(i).dMaxDim); + Frame frame = split.ParentWindow.AreaList.First(); + if (frame != null) + { + frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width"); + frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); + } + } else if (SpElemList.ElementAt(i).dDimension < SpElemList.ElementAt(i).dMinDim) + { SpElemList.ElementAt(i).SetDimension(SpElemList.ElementAt(i).dMinDim); + Frame frame = split.ParentWindow.AreaList.First(); + if (frame != null) + { + frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width"); + frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); + } + } string overlapName = string.Join("_", SpElemList.ElementAt(i).sName.Split('_').Skip(1)); SpElemList.ElementAt(i).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName + "_Overlap")); - } + } break; } } @@ -1280,8 +1307,6 @@ namespace WebWindowComplex { item.SetMinDimension(Window.m_ParameterList.GetValueOrDefault(item.sName + "_DimMin")); item.SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(item.sName + "_DimMax")); - string overlapName = string.Join("_", item.sName.Split('_').Skip(1)); - item.SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName + "_Overlap")); if (item.dDimension > item.dMaxDim) item.SetDimension(item.dMaxDim); else if (item.dMaxDim < item.dMinDim) @@ -1290,6 +1315,235 @@ namespace WebWindowComplex } } + private void SetOverlapSash(Sash sash, SashDimension anta, int indexAnta, List elemList) + { + string overlapNameBottom = ""; + string overlapNameTop = ""; + string overlapNameSx = ""; + string overlapNameDx = ""; + elemList = anta.ElementDimensionList; + List elemOld = elemList; + foreach(var elem in sash.BottomRailElemDimList) + { + elem.SetOverlapElement(Window.m_ParameterList.GetValueOrDefault("Sash_BottomRail_Overlap")); + } + if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split split && split.nSplitQtyHoriz == 0)) + { + Frame frame = sash.ParentWindow.AreaList.First(); + if(frame.SelThreshold.Name.Contains("Threshold")) + overlapNameBottom = "Sash_Threshold"; + else + overlapNameBottom = "Sash_Bottom"; + overlapNameTop = "Sash_Top"; + if(sash.ParentArea is Frame) + { + if(sash.SashList.Count == 1) + { + overlapNameDx = "Sash_Top"; + overlapNameSx = "Sash_Top"; + } + else + { + if(indexAnta == 0) + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = "Sash_Top"; + } + else if (indexAnta == sash.SashList.Count - 1) + { + overlapNameDx = "Sash_Top"; + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + else + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + } + } + else + { + Split s = (Split)sash.ParentArea.ParentArea; + int indexAreaSplit = s.AreaList.IndexOf(sash.ParentArea); + int indexSplit = indexAreaSplit == 0 ? 0 : indexAreaSplit - 1; + if (indexAreaSplit == 0) + { + if (sash.SashList.Count == 1) + { + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameDx = "Mixed_Split_Top"; + else + overlapNameDx = "Sash_Vertical"; + overlapNameSx = "Sash_Top"; + } + else + { + if(indexAnta == 0) + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = "Sash_Top"; + } + else if (indexAnta == sash.SashList.Count - 1) + { + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameDx = "Mixed_Split_Top"; + else + overlapNameDx = "Sash_Vertical"; + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + else + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + } + } + else if (indexAreaSplit == s.AreaList.Count() - 1) + { + if (sash.SashList.Count == 1) + { + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameSx = "Mixed_Split_Top"; + else + overlapNameSx = "Sash_Vertical"; + overlapNameDx = "Sash_Top"; + } + else + { + if (indexAnta == 0) + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameSx = "Mixed_Split_Top"; + else + overlapNameSx = "Sash_Vertical"; + } + else if (indexAnta == sash.SashList.Count - 1) + { + overlapNameDx = "Sash_Top"; + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + else + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + } + } + else + { + if (sash.SashList.Count == 1) + { + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameDx = "Mixed_Split_Top"; + else + overlapNameDx = "Sash_Vertical_Top"; + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameSx = "Mixed_Split_Top"; + else + overlapNameSx = "Sash_Vertical"; + } + else + { + if (indexAnta == 0) + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameSx = "Mixed_Split_Top"; + else + overlapNameSx = "Sash_Vertical"; + } + else if (indexAnta == sash.SashList.Count - 1) + { + if (s.ElemDimVertList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameDx = "Mixed_Split_Top"; + else + overlapNameDx = "Sash_Vertical"; + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + else + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + } + } + } + } + else if (sash.ParentArea.ParentArea is Split s && s.nSplitQtyHoriz > 0) + { + int indexAreaSplit = s.AreaList.IndexOf(sash.ParentArea); + int indexSplit = indexAreaSplit == 0 ? 0 : indexAreaSplit - 1; + if (indexAreaSplit == 0) + { + overlapNameBottom = "Sash_Bottom"; + overlapNameTop = "Mixed_Split_Top"; + } + else if (indexAreaSplit == s.AreaList.Count() - 1) + { + if (s.ElemDimHorizList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameBottom = "Mixed_Split_Bottom"; + else + overlapNameBottom = "Sash_Horizontal_Bottom"; + overlapNameTop = "Sash_Top"; + } + else + { + if (s.ElemDimHorizList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameBottom = "Mixed_Split_Bottom"; + else + overlapNameBottom = "Sash_Horizontal_Bottom"; + if (s.ElemDimHorizList.ElementAt(indexSplit).sName.Contains("Mixed")) + overlapNameTop = "Mixed_Split_Top"; + else + overlapNameTop = "Sash_Horizontal_Top"; + } + if (sash.SashList.Count == 1) + { + overlapNameDx = "Sash_Top"; + overlapNameSx = "Sash_Top"; + } + else + { + if (indexAnta == 0) + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = "Sash_Top"; + } + else if (indexAnta == sash.SashList.Count - 1) + { + overlapNameDx = "Sash_Top"; + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + else + { + overlapNameDx = string.Join("_", elemList.ElementAt(1).sName.Split('_').Skip(1)); + overlapNameSx = string.Join("_", elemList.Last().sName.Split('_').Skip(1)); + } + } + } + elemList.First().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapNameBottom + "_Overlap")); + elemList.ElementAt(1).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapNameDx + "_Overlap")); + for (int elem = 2; elem <= elemList.Count - 2; elem++) + elemList.ElementAt(elem).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapNameTop + "_Overlap")); + elemList.Last().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapNameSx + "_Overlap")); + //bool recalcDim = false; + //for(int i = 0; i < elemList.Count; i++) + //{ + // if (!elemList.ElementAt(i).Equals(elemOld.ElementAt(i))) + // recalcDim = true; + //} + //if (recalcDim) + //{ + // Frame frame = sash.ParentWindow.AreaList.First(); + // if (frame != null) + // { + // frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width"); + // frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); + // } + //} + } + /// /// Metodo per aggiornare valori della sezione General /// @@ -1511,26 +1765,37 @@ namespace WebWindowComplex m_SplitList = new List(); m_SplittedList = new List(); CreateWindowsList((m_CurrWindow!).AreaList.First(), false); - // richiedo update element della sash (se presenti) - if (SashList.Count > 0) - { - foreach (var item in SashList) - { - reqList.Add(item.GroupId); - } - } - // richiedo update element degli split (se presenti) - if (SplitList.Count > 0) - { - foreach (var item in SplitList) - { - reqList.Add(item.GroupId); - } - } + ReqListGroupId(FrameWindow, reqList); + //// richiedo update element della sash (se presenti) + //if (SashList.Count > 0) + //{ + // foreach (var item in SashList) + // { + // reqList.Add(item.GroupId); + // } + //} + //// richiedo update element degli split (se presenti) + //if (SplitList.Count > 0) + //{ + // foreach (var item in SplitList) + // { + // reqList.Add(item.GroupId); + // } + //} await DoReqElement(reqList); } } + private void ReqListGroupId(Area node, List groupId) + { + if (node.AreaList == null) + return; + if(node is Sash || node is Split) + groupId.Add(node.GroupId); + foreach (var child in node.AreaList) + ReqListGroupId(child, groupId); + } + /// /// Aggiornamento opzioni data nuova sash group /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index dfc36af..6a0823c 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.2514 + 3.1.3.217 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -261,5 +261,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 5049759..8391c50 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.2514 + 3.1.3.217 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -210,6 +210,8 @@ + +