From efffc05d52840f2d0ae0a4fd1181be90917a33d6 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Sat, 4 Jan 2025 01:32:02 +1100 Subject: [PATCH] GimbalVideoControl: fix bug in getMousePosition --- Controls/GimbalVideoControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controls/GimbalVideoControl.cs b/Controls/GimbalVideoControl.cs index 7b536d7d25..cce6dd2ded 100644 --- a/Controls/GimbalVideoControl.cs +++ b/Controls/GimbalVideoControl.cs @@ -681,13 +681,13 @@ private void VideoBox_Click(object sender, EventArgs e) { x -= (VideoBox.Width - imageWidth) / 2; x *= VideoBox.Width / imageWidth; - x = Math.Max(0, Math.Min(VideoBox.Width, x)); + x = Math.Max(0, Math.Min(imageWidth, x)); } if (imageHeight < VideoBox.Height) { y -= (VideoBox.Height - imageHeight) / 2; y *= VideoBox.Height / imageHeight; - y = Math.Max(0, Math.Min(VideoBox.Height, y)); + y = Math.Max(0, Math.Min(imageHeight, y)); } return (2 * x / (double)imageWidth - 1, 2 * y / (double)imageHeight - 1);