mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
parent
1df095b43c
commit
e77e1b6380
@ -1456,18 +1456,15 @@ namespace Nikse.SubtitleEdit.Controls
|
|||||||
selectedItem.Focused = true;
|
selectedItem.Focused = true;
|
||||||
|
|
||||||
var topIndex = topItem.Index;
|
var topIndex = topItem.Index;
|
||||||
int bottomIndex = topIndex + (Height - 30) / GetItemRect(0).Height;
|
var numberOfVisibleItems = (Height - 30) / GetItemRect(0).Height;
|
||||||
if (index < topIndex || index > bottomIndex)
|
int bottomIndex = topIndex + numberOfVisibleItems;
|
||||||
|
if (index >= bottomIndex)
|
||||||
{
|
{
|
||||||
var nextScrollToIndex = index + (bottomIndex - topIndex) / 2;
|
Items[Math.Min(Items.Count - 1, index + numberOfVisibleItems)].EnsureVisible();
|
||||||
if (nextScrollToIndex < Items.Count && nextScrollToIndex > 1)
|
}
|
||||||
{
|
else if (index < topIndex)
|
||||||
Items[nextScrollToIndex].EnsureVisible();
|
{
|
||||||
}
|
Items[Math.Max(0, index - numberOfVisibleItems / 2)].EnsureVisible();
|
||||||
else
|
|
||||||
{
|
|
||||||
selectedItem.EnsureVisible();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EndUpdate();
|
EndUpdate();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user