B2016-264: Inserting a centered equation off a centered equation places 2nd equation too far to left in step editor

This commit is contained in:
Kathy Ruffing 2016-11-30 14:16:53 +00:00
parent 651ce71dc1
commit b242d57d4b
2 changed files with 12 additions and 5 deletions

View File

@ -1869,16 +1869,23 @@ namespace Volian.Controls.Library
parentEI = parentEI._MyPreviousEditItem; parentEI = parentEI._MyPreviousEditItem;
myParentEditItem = parentEI._MyParentEditItem; myParentEditItem = parentEI._MyParentEditItem;
} }
// Should center on parent unless it is a centered table in the AER column // Should center on parent unless it is a centered table type in the AER column or parent is another table type, then
int center = myParentEditItem.ContentLeft + myParentEditItem.ContentWidth / 2; // walk up until finding a non-table type step'. (B2016-264: insert of centered eq off centered eq was not locating child equation correctly)
int rightLimit = myParentEditItem.Right; 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 // Then should center on the wid Limit
if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0) if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0)
{ {
int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
rightLimit += colR * MyItemInfo.ColumnMode; rightLimit += colR * MyItemInfo.ColumnMode;
center += (colR * MyItemInfo.ColumnMode) / 2; 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 // Calulate the x location

View File

@ -284,10 +284,10 @@ namespace Volian.Controls.Library
{ {
MyStepRTB.OrigRTF = ""; MyStepRTB.OrigRTF = "";
MyStepRTB.Size = new Size(200, 200); MyStepRTB.Size = new Size(200, 200);
ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
Width = 200; Width = 200;
Height = 200; Height = 200;
ItemWidth = Width; ItemWidth = Width;
ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
} }
this.Controls.Add(this._MyStepRTB); this.Controls.Add(this._MyStepRTB);
} }