Ver código fonte

注释 - 点击注释位置弹出批注弹窗

chenrongqian@kdanmobile.com 1 ano atrás
pai
commit
ba8771769f

+ 15 - 17
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -126,6 +126,7 @@ namespace PDF_Master.ViewModels.Tools
             }
             if (e.ClickCount == 2)
             {
+
                 if (CurrentSelectedAnnot != null)
                 {
                     var type = CurrentSelectedAnnot.EventType;
@@ -134,28 +135,24 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         int dpi = DpiHelpers.Dpi;
                         var rect = CurrentSelectedAnnot.ClientRect;
-                        //rect = new Rect(
-                        //    rect.Left / 72D * dpi,
-                        //    rect.Top / 72D * dpi,
-                        //    rect.Width / 72D * dpi,
-                        //    rect.Height / 72D * dpi);
+                        rect = new Rect(
+                            rect.Left * PDFViewer.ZoomFactor,
+                            rect.Top * PDFViewer.ZoomFactor,
+                            rect.Width * PDFViewer.ZoomFactor,
+                            rect.Height * PDFViewer.ZoomFactor);
                         var ui = PDFViewer.Parent as ContentControl;
                         if (ui != null)
                         {
                             var point = e.GetPosition(ui);
+                            int pageIndex = 0;
+                            Point pagePoint = new Point(0, 0);
+                            //Todo:等黎总需要更新ComPDFKit.dll
+                            //PDFViewer.ConvertViewPointToPage(point, out pageIndex, out pagePoint);
+
+                            if (pagePoint.X >= rect.Left  && pagePoint.X <= rect.Right  && pagePoint.Y >= rect.Top  && pagePoint.Y <= rect.Bottom)
+                                PopAnnotNoteText(CurrentSelectedAnnot);
+
 
-                            double x = point.X / 72D * dpi;
-                            double y = point.Y / 72D * dpi;
-                            point = new Point(x, y);
-                            //if (rect.Contains(point))
-                            //{
-                            PopAnnotNoteText(CurrentSelectedAnnot);
-                            //}
-                            //if (rect.Left <= x && rect.Right >= x && rect.Top <= y && rect.Bottom >= y)
-                            ////if (rect.Left < x && rect.Top > y && (rect.Width + rect.X) >= x && (rect.Height + rect.Y) >= y)
-                            //{
-                            //    PopAnnotNoteText(CurrentSelectedAnnot);
-                            //}
                         }
                     }
 
@@ -164,6 +161,7 @@ namespace PDF_Master.ViewModels.Tools
                         (CurrentSelectedAnnot as StickyAnnotArgs).PopupEditWnd();
                     }
                 }
+
             }
         }