Tastudio Markers - scroll to newly added marker instead of assuming it is the last in the list and scrolling to bottom, fixes #2350

This commit is contained in:
adelikat 2020-09-27 10:54:09 -05:00
parent c8a7c9d98f
commit 32a20dcb3d
1 changed files with 11 additions and 7 deletions

View File

@ -179,6 +179,7 @@ namespace BizHawk.Client.EmuHawk
public void AddMarker(int frame, bool editText = false)
{
TasMovieMarker marker;
if (editText)
{
var i = new InputPrompt
@ -196,20 +197,23 @@ namespace BizHawk.Client.EmuHawk
point.Offset(i.Width / -2, i.Height / -2);
var result = i.ShowHawkDialog(this, position: point);
if (result.IsOk())
if (!result.IsOk())
{
Markers.Add(new TasMovieMarker(frame, i.PromptText));
UpdateTextColumnWidth();
UpdateValues();
return;
}
UpdateTextColumnWidth();
marker = new TasMovieMarker(frame, i.PromptText);
}
else
{
Markers.Add(new TasMovieMarker(frame));
UpdateValues();
marker = new TasMovieMarker(frame);
}
MarkerView.ScrollToIndex(Markers.Count - 1);
UpdateValues();
Markers.Add(marker);
var index = Markers.IndexOf(marker);
MarkerView.MakeIndexVisible(index);
Tastudio.RefreshDialog();
}