mainform: playback: Move song track position to mouse position on click

Allows for smoother track seeking when the song is paused.
For now, we keep the current behavior of disabling all track seeking while the song is playing.
This commit is contained in:
Farex-GH
2022-09-11 00:56:47 -07:00
parent 3dfdec27c6
commit 34ef4c594c
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -753,6 +753,7 @@
this.songTrackBar.TabIndex = 2;
this.songTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.songTrackBar.ValueChanged += new System.EventHandler(this.songTrackBar_ValueChanged);
this.songTrackBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.songTrackBar_MouseDown);
//
// selectSongButton
//
+7
View File
@@ -1976,5 +1976,12 @@ namespace BAKKA_Editor
File.Delete(file);
}
}
private void songTrackBar_MouseDown(object sender, MouseEventArgs e)
{
float val = ((float)e.Location.X / (float)songTrackBar.Width) *
(songTrackBar.Maximum - songTrackBar.Minimum);
songTrackBar.Value = (int)val;
}
}
}