Ver código fonte

【fix】【页面编辑】拖拽页面移动位置,会比预期位置延后一页

tangchao 2 dias atrás
pai
commit
6c54f52589

+ 6 - 2
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -1123,16 +1123,20 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
 //            self.pdfDocument?.movePage(at: UInt(index), withPageAt: UInt(insertIndex+index))
         }
 
+        var theToIndex = toIndex
+        if indexs.count == 1 {
+            theToIndex = insertIndex
+        }
         if after {
             var offset = 0
             for index in indexs {
-                self.pdfDocument?.movePage(at: UInt(index-offset), withPageAt: UInt(toIndex))
+                self.pdfDocument?.movePage(at: UInt(index-offset), withPageAt: UInt(theToIndex))
                 offset += 1
             }
         } else {
             var offset = 0
             for index in indexs.reversed() {
-                self.pdfDocument?.movePage(at: UInt(index+offset), withPageAt: UInt(toIndex))
+                self.pdfDocument?.movePage(at: UInt(index+offset), withPageAt: UInt(theToIndex))
                 offset += 1
             }
         }