|
@@ -92,13 +92,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
self.kmUndoManager = UndoManager()
|
|
|
self.fileAttri_ = KMFileAttribute()
|
|
|
self.fileAttri_?.password = document.password ?? ""
|
|
|
- self.fileAttri_?.filePath = document.documentURL.path ?? ""
|
|
|
+ self.fileAttri_?.filePath = document.documentURL.path
|
|
|
}
|
|
|
|
|
|
override func viewDidAppear() {
|
|
|
super.viewDidAppear()
|
|
|
|
|
|
let isLocked = self.pdfDocument?.isLocked ?? false
|
|
|
+ let first = self.viewFirstAppear
|
|
|
if (isLocked == false && self.viewFirstAppear) {
|
|
|
self.viewFirstAppear = false
|
|
|
if let doc = self.pdfDocument {
|
|
@@ -110,14 +111,12 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
if let view = self.listView { // 存储阅读视图的当前页面索引
|
|
|
self._listViewCurrentIndex = view.currentPageIndex
|
|
|
}
|
|
|
+ var item: Int = 0
|
|
|
if (self.selectedPages.isEmpty) {
|
|
|
- var index: Int = 0
|
|
|
- if (self.listView != nil) {
|
|
|
- index = self.listView!.currentPageIndex
|
|
|
- }
|
|
|
-
|
|
|
+ var index = self.listView?.currentPageIndex ?? 0
|
|
|
self.selectPages(indexs: IndexSet(integer: index))
|
|
|
self.toolBar.setPageRangeString("\(index+1)")
|
|
|
+ item = index
|
|
|
} else {
|
|
|
var indexs: IndexSet = []
|
|
|
for pageIndex in self.selectedPages {
|
|
@@ -131,6 +130,12 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
|
|
|
self.selectPages(indexs: indexs)
|
|
|
self.toolBar.setPageRangeString(KMPageRangeTools.newParseSelectedIndexs(selectedIndex: indexs.sorted()))
|
|
|
+ item = indexs.sorted().last ?? 0
|
|
|
+ }
|
|
|
+ if first {
|
|
|
+ var ips = Set<IndexPath>()
|
|
|
+ ips.insert(IndexPath(item: item, section: 0))
|
|
|
+ self.thumbnailView.collectionView.scrollToItems(at: ips, scrollPosition: .bottom)
|
|
|
}
|
|
|
|
|
|
self.view.window?.makeFirstResponder(self)
|