private async void RegionClickCanvas_MouseUp(object sender, MouseButtonEventArgs e) { if (isSelecting == false) { return; } isSelecting = false; CursorClipper.UnClipCursor(); RegionClickCanvas.ReleaseMouseCapture(); Matrix m = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice; System.Windows.Point mPt = GetMousePos(); System.Windows.Point movingPoint = e.GetPosition(this); movingPoint.X *= m.M11; movingPoint.Y *= m.M22; movingPoint.X = Math.Round(movingPoint.X); movingPoint.Y = Math.Round(movingPoint.Y); if (mPt == movingPoint) { Debug.WriteLine("Probably on Screen 1"); } double correctedLeft = Left; double correctedTop = Top; if (correctedLeft < 0) { correctedLeft = 0; } if (correctedTop < 0) { correctedTop = 0; } double xDimScaled = Canvas.GetLeft(selectBorder) * m.M11; double yDimScaled = Canvas.GetTop(selectBorder) * m.M22; Rectangle regionScaled = new Rectangle( (int)xDimScaled, (int)yDimScaled, (int)(selectBorder.Width * m.M11), (int)(selectBorder.Height * m.M22)); string grabbedText = ""; try { RegionClickCanvas.Children.Remove(selectBorder); } catch { } if (regionScaled.Width < 3 || regionScaled.Height < 3) { BackgroundBrush.Opacity = 0; grabbedText = await ImageMethods.GetClickedWord(this, new System.Windows.Point(xDimScaled, yDimScaled)); } else { grabbedText = await ImageMethods.GetRegionsText(this, regionScaled); } if (Settings.Default.CorrectErrors) { grabbedText.TryFixEveryWordLetterNumberErrors(); } if (SingleLineMenuItem.IsChecked == true) { grabbedText = grabbedText.MakeStringSingleLine(); } if (string.IsNullOrWhiteSpace(grabbedText) == false) { textFromOCR = grabbedText; if (Settings.Default.NeverAutoUseClipboard == false && EditWindow is null) { Clipboard.SetText(grabbedText); } if (Settings.Default.ShowToast && EditWindow is null) { NotificationUtilities.ShowToast(grabbedText); } if (EditWindow is not null) { EditWindow.AddThisText(grabbedText); } WindowUtilities.CloseAllFullscreenGrabs(); } else { BackgroundBrush.Opacity = .2; clippingGeometry.Rect = new Rect( new System.Windows.Point(0, 0), new System.Windows.Size(0, 0)); } }