Browse Source

【阅读模式】阅读模式,右击点击工具,顶部未展示工具栏 修复

lizhe 11 months ago
parent
commit
02ef7027bc

+ 27 - 12
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift

@@ -209,19 +209,34 @@ class KMToolbarController: NSViewController {
             secondaryToolBarBox.isHidden = true
             secondaryToolBarHeight.constant = 51
             let mainToolbarH = self.mainToolBarisVisable ? Self.mainToolBarHeight : 0
-            if _toolbarType == .None {
-                bottomOffset.constant = 0
-                childToolBarBox.isHidden = true
-                self.delegate?.toolbarController?(self, heightOffsetChange: mainToolbarH, animated: false)
-            } else if _toolbarType == .Page || _toolbarType == .LeftPanel || _toolbarType == .redact {
-                bottomOffset.constant = 0
-                childToolBarBox.isHidden = true
-                self.delegate?.toolbarController?(self, heightOffsetChange: mainToolbarH, animated: false)
+            if self.mainViewController!.isReadMode {
+                if (_toolbarType == .Annatiton) {
+                    let childToolbarH = Self.childToolBarHeightValue
+                    bottomOffset.constant = childToolbarH.cgFloat
+                    mainToolBarHeight.constant = 0
+                    childToolBarBox.isHidden = false
+                    self.delegate?.toolbarController?(self, heightOffsetChange: 41, animated: false)
+                } else {
+                    mainToolBarHeight.constant = 0
+                    bottomOffset.constant = 0
+                    childToolBarBox.isHidden = true
+                    self.delegate?.toolbarController?(self, heightOffsetChange: 0, animated: false)
+                }
             } else {
-                let childToolbarH = Self.childToolBarHeightValue
-                bottomOffset.constant = childToolbarH.cgFloat
-                childToolBarBox.isHidden = false
-                self.delegate?.toolbarController?(self, heightOffsetChange: mainToolbarH + childToolbarH, animated: false)
+                if _toolbarType == .None {
+                    bottomOffset.constant = 0
+                    childToolBarBox.isHidden = true
+                    self.delegate?.toolbarController?(self, heightOffsetChange: mainToolbarH, animated: false)
+                } else if _toolbarType == .Page || _toolbarType == .LeftPanel || _toolbarType == .redact {
+                    bottomOffset.constant = 0
+                    childToolBarBox.isHidden = true
+                    self.delegate?.toolbarController?(self, heightOffsetChange: mainToolbarH, animated: false)
+                } else {
+                    let childToolbarH = Self.childToolBarHeightValue
+                    bottomOffset.constant = childToolbarH.cgFloat
+                    childToolBarBox.isHidden = false
+                    self.delegate?.toolbarController?(self, heightOffsetChange: mainToolbarH + childToolbarH, animated: false)
+                }
             }
             childToolBarView?.toolbarType = _toolbarType
             childToolBarView?.reloadateToolbar()

+ 7 - 3
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -109,7 +109,11 @@ extension KMMainViewController: KMToolbarControllerDelegate {
     func toolbarController(_ viewController: KMToolbarController, heightOffsetChange heightOffset: Float, animated: Bool) {
         let heightConst = (animated ? self.heightOffset.animator() : self.heightOffset)
         if self.isReadMode {
-            heightConst?.constant = CGFloat(0)
+            if self.toolbarController.toolbarType == .Annatiton {
+                heightConst?.constant = CGFloat(heightOffset)
+            } else {
+                heightConst?.constant = CGFloat(0)
+            }
         } else {
             heightConst?.constant = CGFloat(heightOffset)
         }
@@ -623,10 +627,10 @@ extension KMMainViewController {
         //设置阅读模式
         self.isReadMode = true
         self.readModelView.isHidden = false
-        
+//        
         //顶部菜单栏状态清空
         self.toolbarController.toolbarType = .None
-        self.toolbarController.view.isHidden = true
+//        self.toolbarController.view.isHidden = true
         self.toolbarController.cancelSelected(KMLeftControlToolbarItemIdentifier)
         self.toolbarController.cancelSelected(KMRightControlToolbarItemIdentifier)
         self.toolbarController.lastItemBox.isSelected = false