diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index f390bdec..4dfbf027 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1869,16 +1869,23 @@ namespace Volian.Controls.Library parentEI = parentEI._MyPreviousEditItem; myParentEditItem = parentEI._MyParentEditItem; } - // Should center on parent unless it is a centered table in the AER column - int center = myParentEditItem.ContentLeft + myParentEditItem.ContentWidth / 2; - int rightLimit = myParentEditItem.Right; + // Should center on parent unless it is a centered table type in the AER column or parent is another table type, then + // walk up until finding a non-table type step'. (B2016-264: insert of centered eq off centered eq was not locating child equation correctly) + EditItem aboveForLocation = myParentEditItem; + if (aboveForLocation.MyItemInfo.IsTable || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsFigure) + { + while (aboveForLocation.MyItemInfo.IsFigure || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsTable) aboveForLocation = aboveForLocation.MyParentEditItem; + } + + int center = aboveForLocation.ContentLeft + aboveForLocation.ContentWidth / 2; + int rightLimit = aboveForLocation.Right; // Then should center on the wid Limit if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0) { int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); rightLimit += colR * MyItemInfo.ColumnMode; center += (colR * MyItemInfo.ColumnMode) / 2; - center -= (myParentEditItem.ContentLeft - (int)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2; + center -= (aboveForLocation.ContentLeft - (int)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2; } // Calulate the x location diff --git a/PROMS/Volian.Controls.Library/RtfRawItem.cs b/PROMS/Volian.Controls.Library/RtfRawItem.cs index 59efb31c..1ce32b98 100644 --- a/PROMS/Volian.Controls.Library/RtfRawItem.cs +++ b/PROMS/Volian.Controls.Library/RtfRawItem.cs @@ -284,10 +284,10 @@ namespace Volian.Controls.Library { MyStepRTB.OrigRTF = ""; MyStepRTB.Size = new Size(200, 200); - ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); Width = 200; Height = 200; ItemWidth = Width; + ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); } this.Controls.Add(this._MyStepRTB); }