diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index a9107f6..e8f722c 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -253,6 +253,7 @@ namespace Test.UI.Components.Pages {"Sash_Slide_Movable_Top_DimStd", 80}, {"Frame_BottomRail_Overlap", 33.2}, {"French_In_Overlap", 26}, + {"French_Out_Overlap", 26}, {"Mixed_Bottom_Overlap", 26}, {"Mixed_Split_Bottom_Overlap", 41}, {"Mixed_Split_Top_Overlap", 41}, @@ -263,6 +264,7 @@ namespace Test.UI.Components.Pages {"NO_Slide_MovableBack_Threshold_Overlap", 0}, {"NO_Slide_Threshold_Overlap", 0}, {"Sash_Active_Overlap", 26}, + {"Sash_Inactive_Overlap", 26}, {"Sash_BottomRail_Overlap", 24.5}, {"Sash_Bottom_Overlap", 26}, {"Sash_Horizontal_Bottom_Overlap", 26}, diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index f78a0d0..4996a9a 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -57,17 +57,19 @@ "Threshold": "Bottom", "BottomRail": false, "BottomRailQty": 0, + "BottomRailElemDimList": [], "GroupId": 1, "AreaList": [ { "IsSashVertical": true, + "IsDimensionLight": true, "SashList": [ { "SashId": 1, "OpeningType": "TILTTURN_LEFT", + "MeasureType": "PROPORTIONAL", + "Dimension": 1, "HasHandle": true, - "Dimension": 50.0, - "MeasureType": "PERCENTAGE", "ElementDimensionList": [ { "Index": 1, @@ -108,9 +110,9 @@ { "SashId": 2, "OpeningType": "TURNONLY_RIGHT", + "MeasureType": "PROPORTIONAL", + "Dimension": 2, "HasHandle": false, - "Dimension": 50.0, - "MeasureType": "PERCENTAGE", "ElementDimensionList": [ { "Index": 1, @@ -152,43 +154,9 @@ "SashType": "NULL", "BottomRail": false, "BottomRailQty": 0, - "BottomRailElemDimList": [ - { - "Index": 1, - "Value": 78.0 - } - ], - "Hardware": "000633", - "HwOptionList": [ - { - "Name": "Entrata", - "Value": "15" - }, - { - "Name": "LavManigliaPassante", - "Value": "false" - }, - { - "Name": "PosizioneForoCilindro", - "Value": "sotto" - }, - { - "Name": "Deviatore", - "Value": "false" - }, - { - "Name": "ModelloCilindro", - "Value": "c999" - }, - { - "Name": "LavCilindroPassante", - "Value": "false" - }, - { - "Name": "HMan", - "Value": "400" - } - ], + "BottomRailElemDimList": [], + "Hardware": "000631", + "HwOptionList": [], "GroupId": 2, "AreaList": [ { diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index 1e2fcfb..c189523 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -325,6 +325,7 @@ namespace WebWindowComplex.Compo public Frame currFrame { get; set; } = null!; public bool svgNoHw { get; set; } = false; + public int groupIdDelete { get; set; } = -1; #endregion Public Properties } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 57838a3..1822049 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -207,7 +207,8 @@ namespace WebWindowComplex.Compo FrameWindow.SetSelThresholdFromName(FrameWindow.ThresholdList.FirstOrDefault(x => x.Name != "Threshold")?.Name); var args = new DataUpdateFrame() { - currFrame = FrameWindow + currFrame = FrameWindow, + groupIdDelete = CurrSashGroup.GroupId }; // richiesta reset dict shape await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req=DataAction.ResetDictShape}); diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index 25654c7..077894d 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -5,7 +5,7 @@ @for (int i = 0; i < ItemTableList.Count; i++) { - @for (int j = 0; j < maxCol - 1; j++) + @for (int j = 0; j < maxCol; j++) { var index = RowCollapsedDict.Keys.Where(k => k <= i).LastOrDefault(); @if ((RowCollapsedDict.ContainsValue(true) && RowCollapsedDict.GetValueOrDefault(index)) diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 3e0e34f..858a73f 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -258,7 +258,7 @@ namespace WebWindowComplex.Models Sash s = (Sash)node; List dimList = new List(); foreach (var item in s.SashList) - dimList.Add(new AreaDimension(item.dDimension, item.MeasureType)); + 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 @@ -271,7 +271,7 @@ namespace WebWindowComplex.Models if (s.SplitHorizList.Count > 0 && i < s.SplitHorizList.Count) { foreach (var item in s.SplitHorizList) - dimList.Add(new AreaDimension(item.dDimension, item.MeasureType)); + dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); if(nameDim.Equals("Width")) SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); else @@ -280,7 +280,7 @@ namespace WebWindowComplex.Models if (s.SplitVertList.Count > 0 && i < s.SplitVertList.Count) { foreach (var item in s.SplitVertList) - dimList.Add(new AreaDimension(item.dDimension, item.MeasureType)); + 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); else @@ -313,13 +313,13 @@ namespace WebWindowComplex.Models else frame = (Frame)sash.ParentArea; foreach (var i in frame.DimensionList) - dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType)); + dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent)); } else { //Split s = (Split)sash.ParentArea.ParentArea; foreach (var i in split.SplitVertList) - dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType)); + dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent)); } if (countAbsolute == sash.SashList.Count) { @@ -414,7 +414,7 @@ namespace WebWindowComplex.Models List adList = new List(); foreach (var it in sashGroup.SashList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } //Somma misura non proporzionali double sumNotProp = sashGroup.SashList @@ -451,7 +451,7 @@ namespace WebWindowComplex.Models List adList = new List(); foreach (var it in splitList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } //Somma misura non proporzionali double sumNotProp = splitList diff --git a/WebWindowComplex/Models/AreaDimension.cs b/WebWindowComplex/Models/AreaDimension.cs index 43662ac..d81f37c 100644 --- a/WebWindowComplex/Models/AreaDimension.cs +++ b/WebWindowComplex/Models/AreaDimension.cs @@ -11,11 +11,11 @@ namespace WebWindowComplex.Models { #region Public Constructors - public AreaDimension(double dDimension, MeasureTypes MeasureType) + public AreaDimension(double dDimension, MeasureTypes MeasureType, Area Parent) { m_dDimension = dDimension; m_SelMeasureType = MeasureType; - //m_Parent = Parent; + m_Parent = Parent; } #endregion Public Constructors @@ -34,17 +34,17 @@ namespace WebWindowComplex.Models } } - //public Area Parent - //{ - // get - // { - // return m_Parent; - // } - // set - // { - // m_Parent = value; - // } - //} + public Area Parent + { + get + { + return m_Parent; + } + set + { + m_Parent = value; + } + } public MeasureTypes MeasureType { @@ -105,7 +105,7 @@ namespace WebWindowComplex.Models protected MeasureTypes m_SelMeasureType; // reference - // protected Area m_Parent; + protected Area m_Parent; #endregion Private Fields @@ -122,7 +122,7 @@ namespace WebWindowComplex.Models /// Vecchio tipo /// Nuovo tipo /// - public double ConvertDimension(List itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash) + public double ConvertDimension(List itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash, double overlap) { switch (oldType) { @@ -130,8 +130,17 @@ namespace WebWindowComplex.Models { if (newType.Equals(MeasureTypes.PERCENTAGE)) { + double overlapElem = 0; + if (m_Parent is Sash) + { + // Calcolo overlap + Sash s = (Sash)m_Parent; + int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1; + if (!s.bIsDimensionLight) + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + } //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1); - return (dDimension / widthTot) * 100; + return ((dDimension - overlapElem) / widthTot) * 100; } else { @@ -142,8 +151,17 @@ namespace WebWindowComplex.Models { if (newType.Equals(MeasureTypes.ABSOLUTE)) { + double overlapElem = 0; + if(m_Parent is Sash) + { + // Calcolo overlap + Sash s = (Sash)m_Parent; + int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1; + if (!s.bIsDimensionLight) + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + } //return Double.Round(ConvertFromPropVal(newType), 2); - return ConvertFromPropVal(itemList, newType, widthTot); + return ConvertFromPropVal(itemList, newType, widthTot) + overlapElem; } else { @@ -155,8 +173,17 @@ namespace WebWindowComplex.Models { if (newType.Equals(MeasureTypes.ABSOLUTE)) { + double overlapElem = 0; + if (m_Parent is Sash) + { + // Calcolo overlap + Sash s = (Sash)m_Parent; + int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1; + if (!s.bIsDimensionLight) + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap; + } //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2); - return (dDimension * widthTot) / 100; + return (dDimension * widthTot) / 100 + overlapElem; } else { @@ -250,7 +277,17 @@ namespace WebWindowComplex.Models case MeasureTypes.ABSOLUTE: { //return Double.Round(dDimension, 2); - return dDimension; + double overlapElem = 0; + if (m_Parent is Sash) + { + // Calcolo overlap + Sash s = (Sash)m_Parent; + int indexSash = itemList.IndexOf(this); + int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1; + if (!s.bIsDimensionLight) + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + } + return dDimension - overlapElem; } case MeasureTypes.PROPORTIONAL: { diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index 25b8a7f..94c52c6 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -402,29 +402,41 @@ namespace WebWindowComplex.Models m_ThresholdList = m_AllThresholdList; } - public double HeightFrame() + public double AvailHeightFrame() { + double dim = 0; switch (SelShapeIndex) { case (int)Shapes.RECTANGLE: case (int)Shapes.TRIANGLE: case (int)Shapes.ARC_FULL: { - return DimensionList.Where(x => x.sName == "Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Height").First().dDimension; + break; } case (int)Shapes.RIGHTCHAMFER: { - return DimensionList.Where(x => x.sName == "Left Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Left Height").First().dDimension; + break; } case (int)Shapes.LEFTCHAMFER: { - return DimensionList.Where(x => x.sName == "Right Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Right Height").First().dDimension; + break; } default: { - return DimensionList.Where(x => x.sName == "Full Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Full Height").First().dDimension; + break; } } + double overlap = 0; + if (AreaList.First() is Sash) + overlap = ElementDimensionList.ElementAt(1).dOverlap + + ElementDimensionList.ElementAt(ElementDimensionList.Count() - 2).dOverlap; + return dim - ElementDimensionList.ElementAt(0).dDimension - + ElementDimensionList.Last().dDimension + + overlap; } public override Frame Copy(Area ParentArea) @@ -432,6 +444,26 @@ namespace WebWindowComplex.Models return new Frame(null, ParentWindow); } + /// + /// Metodo per calcolare l'area disponibile + /// + /// + public double AvailWidthArea() + { + if (DimensionList.Count > 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null) + { + double dim = DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension; + double overlap = 0; + if(AreaList.First() is Sash) + overlap = ElementDimensionList.ElementAt(1).dOverlap + + ElementDimensionList.Last().dOverlap; + return dim - ElementDimensionList.ElementAt(0).dDimension - + ElementDimensionList.Last().dDimension + + overlap; + } + return -1; + } + #endregion Public Methods #region Internal Methods @@ -661,24 +693,6 @@ namespace WebWindowComplex.Models } } - /// - /// Metodo per calcolare l'area disponibile - /// - /// - internal double AvailArea() - { - if(DimensionList.Count> 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null) - { - // larghezza - elementDim(1) - elementDim(last) + overlapDd + overlapSx - return DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension - - ElementDimensionList.ElementAt(1).dDimension - - ElementDimensionList.Last().dDimension + - ElementDimensionList.ElementAt(1).dOverlap + - ElementDimensionList.Last().dOverlap; - } - return -1; - } - #endregion Internal Methods #region Private Fields diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index da3f8ac..9ee1a43 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -13,7 +13,7 @@ namespace WebWindowComplex.Models { #region Public Constructors - public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE) + public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE, ParentFrame) { m_ParentFrame = ParentFrame; m_nIndex = nIndex; diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index f58a2f3..a57396a 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -267,8 +267,17 @@ namespace WebWindowComplex.Models { if (value > 0 && value <= 3) { - double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension); // TODO: width se anta è in un'area di split - //double widthTot = ((Frame)ParentArea).AvailArea(); + Frame frame = (Frame)ParentWindow.AreaList.First(); + double widthTot = 0; + if (bIsDimensionLight) + { + foreach (var item in m_SashList) + widthTot = widthTot + item.dDimension; + } + else + { + widthTot = CalculateWidthSashGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + } if (value > m_SashList.Count) { // recupero larghezza ultimo @@ -277,9 +286,20 @@ namespace WebWindowComplex.Models if (m_SashList.Count > 0) { dLastDimension = m_SashList[m_SashList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSashQty); if (m_SashList[m_SashList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) dNewDimension = 1; + else if (m_SashList[m_SashList.Count - 1].MeasureType is MeasureTypes.PERCENTAGE) + dNewDimension = dLastDimension / (value + 1 - nSashQty); + else + { + if (bIsDimensionLight) + dNewDimension = (dLastDimension - m_SashList.Last().ElementDimensionList.ElementAt(1).dDimension + - m_SashList.Last().ElementDimensionList.Last().dDimension + + m_SashList.Last().ElementDimensionList.Last().dOverlap) / 2; + else + dNewDimension = dLastDimension / (value + 1 - nSashQty) + + (m_SashList.Last().ElementDimensionList.Last().dOverlap / 2); + } m_SashList[m_SashList.Count - 1].SetDimension(dNewDimension); } else @@ -301,28 +321,37 @@ namespace WebWindowComplex.Models { double dLastDimension = 0; SashDimension itemDelete = new SashDimension(0, MeasureTypes.NULL, this, 0); - double deleteDim; + double deleteDim = 0; + double splitDelete = 0; for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1) { - //dLastDimension += m_SashList[SplitIndex].dDimension; itemDelete = m_SashList[SplitIndex]; + if(itemDelete.SelMeasureType is MeasureTypes.ABSOLUTE) + { + if (bIsDimensionLight) + splitDelete = m_SashList[m_SashList.Count - 2].ElementDimensionList.ElementAt(1).dDimension + + m_SashList.Last().ElementDimensionList.Last().dDimension + - m_SashList.Last().ElementDimensionList.Last().dOverlap; + else + splitDelete = - m_SashList.Last().ElementDimensionList.Last().dOverlap; + } SashList.RemoveAt(SplitIndex); } if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType)) { - AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType); + AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType, itemDelete.Parent); List adList = new List(); foreach (var it in SashList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + 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)); + deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete), SashList.Last().ElementDimensionList.Last().dOverlap); } else { deleteDim = itemDelete.dDimension; } - dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension; + dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension + splitDelete; SashList[SashList.Count - 1].SetDimension(dLastDimension); if (value == 1) SashList.First().SetHasHandle(true); @@ -741,6 +770,7 @@ namespace WebWindowComplex.Models { m_IsbDimensionLight = DimensionLight; } + internal static Sash CreateSash(Area Area) { Sash newSash = new Sash(Area, Area.ParentWindow); @@ -1056,6 +1086,135 @@ namespace WebWindowComplex.Models } } + internal AreaFound CalculateWidthSashGroup(Area area, double width, AreaFound 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 split = (Split)area; + if (split.SplitVertList.Count > 0) + { + double dim = width; + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + dim = split.SplitVertList.ElementAt(i).dDimension; + break; + } + case MeasureTypes.PROPORTIONAL: + { + double widthGlass = width; + AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType, split.SplitVertList.ElementAt(i).Parent); + List adList = new List(); + foreach (var it in split.SplitVertList) + { + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + } + foreach (var elem in split.ElemDimVertList) + { + widthGlass = widthGlass - elem.dDimension; + } + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass); + break; + } + case MeasureTypes.PERCENTAGE: + { + foreach (var elem in split.ElemDimVertList) + { + dim = dim - elem.dDimension; + } + dim = split.SplitVertList.ElementAt(i).dDimension * dim / 100; + break; + } + } + if (split.ParentArea is 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) + { + 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); + } + } + res = CalculateWidthSashGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateWidthSashGroup(item, width, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + else if (area is Sash) + { + Sash sash = (Sash)area; + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + res = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension, res); + break; + } + case MeasureTypes.PROPORTIONAL: + { + SashDimension anta = sash.SashList.ElementAt(i); + AreaDimension ad = new AreaDimension(anta.dDimension, anta.SelMeasureType, anta.Parent); + List adList = new List(); + foreach (var it in sash.SashList) + { + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + } + res = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); + break; + } + case MeasureTypes.PERCENTAGE: + { + res = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res); + break; + } + } + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else if (area is Frame) + { + Frame f = (Frame)area; + res = CalculateWidthSashGroup(item, f.AvailWidthArea(), res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateWidthSashGroup(item, width, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + return res; + } + #endregion Internal Methods #region Private Fields @@ -1079,7 +1238,6 @@ namespace WebWindowComplex.Models private int m_nSashBottomRailQty; - private List m_ElementDimensionList = new List(); private List m_BottomRailElemDimList = new List(); private List m_OrientationSashTypeList = new List { diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 8ff5213..2573aeb 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using System; +using System.Runtime.InteropServices; using System.Security.Principal; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -9,7 +10,7 @@ namespace WebWindowComplex.Models { #region Public Constructors - public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType) + public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType, Parent) { m_dDimension = dDimension; m_nSashId = nSashId; @@ -149,25 +150,25 @@ namespace WebWindowComplex.Models } set { - if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); - //double widthTot = ((Frame)m_Parent.ParentArea).AvailArea(); - //if (m_Parent.bIsDimensionLight) - //{ - // for (int i = 0; i < m_Parent.SashList.Count; i++) - // { - // if(i == 0) - // widthTot = widthTot - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - // else - // widthTot = widthTot - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension - // + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap; - // } - //} + double widthTot = (Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false))).m_Dimension; + if (m_Parent.bIsDimensionLight) + { + for (int i = 0; i < m_Parent.SashList.Count; i++) + { + if (i == 0) + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + } double valMinAbsolute = 100; double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1); bool valueAccept = false; @@ -196,11 +197,11 @@ namespace WebWindowComplex.Models { List dimensions = m_Parent.SashList; List absoluteValList = new List(); - AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType); + AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in m_Parent.SashList) { - adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent)); } int index = 0; foreach (var item in m_Parent.SashList) @@ -403,25 +404,41 @@ namespace WebWindowComplex.Models if(SelMeasureType != (MeasureTypes)value) { MeasureTypes newType = (MeasureTypes)value; - if (m_Parent.ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); - // TODO: availArea per aree che non sono frame - //double widthTot = ((Frame)m_Parent.ParentArea).AvailArea(); - AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType); + double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + if (Parent.bIsDimensionLight) + { + for (int i = 0; i < m_Parent.SashList.Count; i++) + { + if (i == 0) + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + } + AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in m_Parent.SashList) { - adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType)); - //if (it.SelMeasureType is MeasureTypes.ABSOLUTE) - //{ - // if (it.bHasHandle) - // adList.Add(new AreaDimension(it.m_dDimension - (it.ElementDimensionList.ElementAt(1).dOverlap) / 2, it.SelMeasureType)); - // else - // adList.Add(new AreaDimension(it.m_dDimension - (it.ElementDimensionList.Last().dOverlap) / 2, it.SelMeasureType)); - //} + adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent)); } - m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1); + 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); SelMeasureType = (MeasureTypes)value; } } @@ -464,100 +481,6 @@ namespace WebWindowComplex.Models m_dDimension = Dimension; } - /// - /// Metodo per calcolare larghezza intera sash group - /// - /// area di partenza - /// larghezza di partenza - /// - internal double CalculateWidthSashGroup(Area area, double width) - { - if (width < 1) - return width; - for(int i = 0; i < area.AreaList.Count; i++) - { - double risultato = -1; - if (area.Equals(m_Parent)) - return width; - Area item = area.AreaList[i]; - if (area is Split) - { - Split split = (Split)area; - if (split.SplitVertList.Count > 0) - { - switch (split.SplitVertList.ElementAt(i).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PROPORTIONAL: - { - AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType); - List adList = new List(); - foreach(var it in split.SplitVertList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); - } - risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width)); - break; - } - case MeasureTypes.PERCENTAGE: - { - risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); - break; - } - } - if (risultato != -1) - return risultato; - } - else - { - risultato = CalculateWidthSashGroup(item, width); - } - } - else if (area is Sash) - { - Sash sash = (Sash)area; - switch (sash.SashList.ElementAt(i).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PROPORTIONAL: - { - //risultato = CalculateWidthSashGroup(item, ConvertFromPropVal(MeasureTypes.ABSOLUTE, width, sash.SashList.ElementAt(i).dDimension)); - AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType); - List adList = new List(); - foreach (var it in sash.SashList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); - } - risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width)); - break; - } - case MeasureTypes.PERCENTAGE: - { - risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); - break; - } - } - if (risultato != -1) - return risultato; - } - else - { - risultato = CalculateWidthSashGroup(item, width); - if (risultato != -1) - return risultato; - } - } - return width; - } - internal JsonSashDimension Serialize() { JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, dDimension, m_nSashId); @@ -593,17 +516,41 @@ namespace WebWindowComplex.Models if (SelMeasureType != (MeasureTypes)value) { MeasureTypes newType = (MeasureTypes)value; - if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null) + Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + if (Parent.bIsDimensionLight) + { + for(int i = 0; i < Parent.SashList.Count; i++) + { + if (i == 0) + widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + } + 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)); + newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash); - if(newType is MeasureTypes.PROPORTIONAL) + 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); diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index ef880af..94500a6 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -95,7 +95,7 @@ namespace WebWindowComplex.Models if (m_SplitHorizList.Count > 0) { dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz); + dNewDimension = (dLastDimension - m_ElemDimHorizList.Last().dDimension) / (value + 1 - nSplitQtyHoriz); if (m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) dNewDimension = 1; m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension); @@ -133,7 +133,7 @@ namespace WebWindowComplex.Models double dLastDimension = 0; for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) { - dLastDimension += m_SplitHorizList[SplitIndex].dDimension; + dLastDimension += m_SplitHorizList[SplitIndex].dDimension + m_ElemDimHorizList[SplitIndex - 1].dDimension; m_SplitHorizList.RemoveAt(SplitIndex); } dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; @@ -213,9 +213,10 @@ namespace WebWindowComplex.Models } else { - if(ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); + double widthTot = CalculateWidthArea(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension); // Ricalcolo dimensioni aggiungendo split if (value > m_SplitVertList.Count - 1) { @@ -225,7 +226,7 @@ namespace WebWindowComplex.Models if (m_SplitVertList.Count > 0) { dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert); + dNewDimension = (dLastDimension - ElemDimVertList.Last().dDimension) / (value + 1 - nSplitQtyVert); if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) dNewDimension = 1; m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension); @@ -276,7 +277,7 @@ namespace WebWindowComplex.Models double dLastDimension = 0; for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) { - dLastDimension += m_SplitVertList[SplitIndex].dDimension; + dLastDimension += m_SplitVertList[SplitIndex].dDimension + ElemDimVertList[SplitIndex - 1].dDimension; m_SplitVertList.RemoveAt(SplitIndex); } dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension; diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 15e1c5a..f5a9a01 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -13,7 +13,7 @@ namespace WebWindowComplex.Models { #region Public Constructors - public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType) + public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType, Parent) { m_dDimension = dDimension; m_bIsRelative = bIsRelative; @@ -61,7 +61,7 @@ namespace WebWindowComplex.Models { dimensions = m_Parent.SplitHorizList; //dimensionTot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension; - dimensionTot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension; + dimensionTot = (CalculateHeightSplitGroup(frame, frame.AvailHeightFrame(), new AreaFound(-1, false))).m_Dimension; } double valMinAbsolute = 100; double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1); @@ -90,11 +90,11 @@ namespace WebWindowComplex.Models if (valueAccept) { List absoluteValList = new List(); - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in dimensions) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } foreach (var item in dimensions) { @@ -260,20 +260,29 @@ namespace WebWindowComplex.Models if (bIsVertListDim) { splitList = m_Parent.SplitVertList; - tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + //tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + tot = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + foreach (var item in m_Parent.ElemDimVertList) + { + tot = tot - item.dDimension; + } } else { splitList = m_Parent.SplitHorizList; - tot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension; + tot = (CalculateHeightSplitGroup(frame, frame.AvailHeightFrame(), new AreaFound(-1, false))).m_Dimension; + foreach (var item in m_Parent.ElemDimHorizList) + { + tot = tot - item.dDimension; + } } - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in splitList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this)); + m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this), 0); m_SelMeasureType = (MeasureTypes)value; } } @@ -329,11 +338,11 @@ namespace WebWindowComplex.Models } case MeasureTypes.PROPORTIONAL: { - AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType); + AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent); List adList = new List(); foreach (var it in split.SplitVertList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); break; @@ -361,23 +370,40 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUTE: { - res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension, res); + 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); break; } case MeasureTypes.PROPORTIONAL: { - AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType); + 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)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); + int index = adList.IndexOf(ad) == 0 ? 1 : adList.Count - 1; + double dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width) + 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); break; } case MeasureTypes.PERCENTAGE: { - res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res); + 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); break; } } @@ -430,11 +456,11 @@ namespace WebWindowComplex.Models } case MeasureTypes.PROPORTIONAL: { - AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType); + 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)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } double heightItemGroup = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height); res = CalculateHeightSplitGroup(item, heightItemGroup, res); @@ -457,6 +483,15 @@ namespace WebWindowComplex.Models return res; } } + else if (area is Sash) + { + Sash s = (Sash)area; + height = height - s.SashList.First().ElementDimensionList.First().dDimension + - s.SashList.First().ElementDimensionList.ElementAt(s.SashList.First().ElementDimensionList.Count - 2).dDimension; + res = CalculateHeightSplitGroup(item, height, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } else { res = CalculateHeightSplitGroup(item, height, res); @@ -499,32 +534,42 @@ namespace WebWindowComplex.Models double dimSplitGroup = 0; if (bIsVertListDim) { - dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension; - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + //dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension; + dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false))).m_Dimension; + foreach (var item in m_Parent.ElemDimVertList) + { + dimSplitGroup = dimSplitGroup - item.dDimension; + } + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List newDimensions = new List(); foreach (var item in m_Parent.SplitVertList) { - newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType)); + newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this)); + 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); } - } } + } + } else { //tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension; - dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension; - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightFrame(), new AreaFound(-1, false))).m_Dimension; + foreach (var item in m_Parent.ElemDimHorizList) + { + dimSplitGroup = dimSplitGroup - item.dDimension; + } + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List newDimensions = new List(); foreach (var item in m_Parent.SplitHorizList) { - newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType)); + newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this)); + 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++) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index af6f3cf..7e08e13 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -638,6 +638,7 @@ namespace WebWindowComplex { firstDisplay = false; // preview SVG senza HW + await UpdateElement(FrameWindow); await DoPreviewSvg(true, true); } List reqList = SashList.Select(x => x.GroupId).ToList(); @@ -1262,12 +1263,7 @@ 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")); string overlapName = string.Join("_", SpElemList.ElementAt(i).sName.Split('_').Skip(1)); - SpElemList.ElementAt(i).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_Overlap")); - //// Se la lista in precedenza era vuota, metto i valori di default - //if (prevLiveData.ProfElementList == null || prevLiveData.ProfElementList.Count == 0) - //{ - // SpElemList.ElementAt(i).SetDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimStd")); - //} + SpElemList.ElementAt(i).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName + "_Overlap")); } break; } @@ -1278,11 +1274,6 @@ namespace WebWindowComplex 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")); - // Se la lista in precedenza era vuota, metto i valori di default - //if (prevLiveData.ProfElementList == null || prevLiveData.ProfElementList.Count == 0) - //{ - // item.SetDimension(Window.m_ParameterList.GetValueOrDefault(item.sName + "_DimStd")); - //} } } } @@ -1398,6 +1389,8 @@ namespace WebWindowComplex { Frame newFrame = args.currFrame; bool forceSvgNoHw = args.svgNoHw; + if (args.groupIdDelete != -1) + RowCollapsed.Remove(args.groupIdDelete); if (newFrame != null) { // cerco il record @@ -1610,6 +1603,7 @@ namespace WebWindowComplex // richiedo update shape List reqList = SashList.Select(x => x.GroupId).ToList(); await DoPreviewSvg(); + await UpdateElement(FrameWindow); await DoReqShape(reqList); } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index c714b55..b302bba 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.1012 + 3.1.2.1218 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -118,5 +118,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 712f8cc..dc73505 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.1012 + 3.1.2.1218 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -102,6 +102,9 @@ + + +