Browse Source

ComPDFKit.Tool(win)-(补充:撤回上条记录)多选移动补充移动距离接口,优化移动精度

liyijie 7 months ago
parent
commit
17a56b7809

+ 8 - 5
Demo/Examples/ComPDFKit.Tool/CPDFToolManager.cs

@@ -559,18 +559,21 @@ namespace ComPDFKit.Tool
                         if ((float)point.X == 0)
                         {
                             cRect.left += (float)point.X;
-                            cRect.right = cRect.left + (cRect.right - cRect.left) * e.ZoomX;
+                            cRect.right = cRect.left + (cRect.right - cRect.left) + (float)DpiHelper.StandardNumToPDFNum(e.ChangeX) / zoom;
                         }
-                        else {
-                            
+                        else
+                        {
+
                             cRect.left += (float)point.X;
                         }
                         if ((float)point.Y == 0)
                         {
                             cRect.top += (float)point.Y;
-                            cRect.bottom = cRect.top + (cRect.bottom - cRect.top) * e.ZoomY;
+                            cRect.bottom = cRect.top + (cRect.bottom - cRect.top) + (float)DpiHelper.StandardNumToPDFNum(e.ChangeY) / zoom;
                         }
-                        else {
+
+                        else
+                        {
                             
                             cRect.top += (float)point.Y;
                         }

+ 10 - 0
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.MultiSelectedRect.cs

@@ -27,6 +27,16 @@ namespace ComPDFKit.Tool
         public float ZoomX { get; set; }
 
         public float ZoomY { get; set; }
+
+        /// <summary>
+        /// Multiple selection of movement distance
+        /// </summary>
+        public float ChangeX { get; set; }
+
+        /// <summary>
+        /// Multiple selection of movement distance
+        /// </summary>
+        public float ChangeY { get; set; }
     }
 
     public partial class CPDFViewerTool

+ 19 - 0
Demo/Examples/ComPDFKit.Tool/DrawTool/MultiSelectedRect.cs

@@ -339,6 +339,25 @@ namespace ComPDFKit.Tool.DrawTool
             return (float)(drawRect.Height / drawDefaultRect.Height);
         }
 
+        /// <summary>
+        /// Multiple selection of movement distance
+        /// </summary>
+        /// <returns></returns>
+        public float GetChangeX()
+        {
+            return (float)(drawRect.Width - drawDefaultRect.Width);
+        }
+
+        /// <summary>
+        /// Multiple selection of movement distance
+        /// </summary>
+        /// <returns></returns>
+        public float GetChangeY()
+        {
+            return (float)(drawRect.Height - drawDefaultRect.Height);
+        }
+
+
         public void Draw()
         {
             switch (currentDrawType)