1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-17 00:31:42 +02:00

Fix video player seek bar tooltip not disappearing when cursor moves outside

This commit is contained in:
2018-11-20 18:30:06 +01:00
parent 97ad7a3e68
commit a9c140c0fc
2 changed files with 12 additions and 1 deletions

@@ -19,7 +19,14 @@ namespace TweetDuck.Video.Controls{
Form form = control.FindForm(); Form form = control.FindForm();
System.Diagnostics.Debug.Assert(form != null); System.Diagnostics.Debug.Assert(form != null);
Text = tooltipFunc(args); string text = tooltipFunc(args);
if (text == null){
Visible = false;
return;
}
Text = text;
Point loc = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X+(followCursor ? args.X : control.Width/2), 0))); Point loc = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X+(followCursor ? args.X : control.Width/2), 0)));
loc.X = Math.Max(0, Math.Min(form.Width-Width, loc.X-Width/2)); loc.X = Math.Max(0, Math.Min(form.Width-Width, loc.X-Width/2));

@@ -57,6 +57,10 @@ namespace TweetDuck.Video{
trackBarVolume.Value = volume; // changes player volume too if non-default trackBarVolume.Value = volume; // changes player volume too if non-default
labelTooltip.AttachTooltip(progressSeek, true, args => { labelTooltip.AttachTooltip(progressSeek, true, args => {
if (args.X < 0 || args.Y < 0 || args.X >= progressSeek.Width || args.Y >= progressSeek.Height){
return null;
}
IWMPMedia media = Player.currentMedia; IWMPMedia media = Player.currentMedia;
int progress = (int)(media.duration*progressSeek.GetProgress(args.X)); int progress = (int)(media.duration*progressSeek.GetProgress(args.X));