From 34ef4c594c77277b7567f30d7fc13afd6ce54b73 Mon Sep 17 00:00:00 2001 From: Farex-GH Date: Sun, 11 Sep 2022 00:53:03 -0700 Subject: [PATCH] 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. --- BAKKA-Editor/MainForm.Designer.cs | 1 + BAKKA-Editor/MainForm.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/BAKKA-Editor/MainForm.Designer.cs b/BAKKA-Editor/MainForm.Designer.cs index 3ea9102..e8285ae 100644 --- a/BAKKA-Editor/MainForm.Designer.cs +++ b/BAKKA-Editor/MainForm.Designer.cs @@ -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 // diff --git a/BAKKA-Editor/MainForm.cs b/BAKKA-Editor/MainForm.cs index 4aecd0e..0646d6f 100644 --- a/BAKKA-Editor/MainForm.cs +++ b/BAKKA-Editor/MainForm.cs @@ -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; + } } } \ No newline at end of file