C2023-008: Long sub-step centers after edit making edit, if towards bottom of step, no longer visible

This commit is contained in:
Kathy Ruffing 2023-04-21 15:50:22 +00:00
parent 59ce74de34
commit c1904169f5

View File

@ -2266,6 +2266,9 @@ namespace Volian.Controls.Library
//vlnStackTrace.ShowStack("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);// Show StackTrace
//Console.WriteLine("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);
if (Top >= 0 && Bottom <= MyStepPanel.Height) return;// Don't move if within screen.
// C2023-008: if step is larger than the current step panel height, don't center. This was shifting step so that
// if text was changed closer to bottom of step, the change was no longer visible.
if ((Bottom - Top) > _MyStepPanel.Height) return;
int scrollValue = MyStepPanel.VerticalScroll.Value + (Top - (MyStepPanel.Height / 2)); // calculate scroll center for the item
// Limit scroll location within allowable values
scrollValue = Math.Max(MyStepPanel.VerticalScroll.Minimum, Math.Min(MyStepPanel.VerticalScroll.Maximum, scrollValue));