فهرست منبع

【测量】补充新手引导

tangchao 6 ماه پیش
والد
کامیت
a61da84439

+ 10 - 0
PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMOpenFileFunctionView.swift

@@ -114,6 +114,16 @@ class KMOpenFileFunctionView: NSView, NibLoadable {
             self.tipSubTitleLabel.stringValue = NSLocalizedString("The document compare feature lets you quickly spot differences between two versions of a PDF for a better review process.", comment: "")
             self.getItLabel.stringValue = NSLocalizedString("Got it", comment: "")
             
+        } else if self.type == .measureGuide {
+            if self.window != nil {
+                self.circleTopConst.constant = (self.window?.frame.size.height)! - self.circleRect.origin.y - NSHeight(self.bigCircleView.frame) + 50
+            }
+            self.circleLeftConst.constant = NSMinX(KMGuideInfoWindowController.currentWC().compareItemRect) - NSWidth(self.bigCircleView.frame)/2 + NSWidth(KMGuideInfoWindowController.currentWC().compareItemRect)/2
+            self.tipImage.image = NSImage(named: "guideMeasure")
+            self.tipTitleLabel.stringValue = NSLocalizedString("Measure", comment: "")
+            self.tipSubTitleLabel.stringValue = NSLocalizedString("You can measure distance, perimeter, area and angle accurately with the measuring tools.", comment: "")
+            self.getItLabel.stringValue = NSLocalizedString("Got it", comment: "")
+            
         }
         self.shadowView.layer?.shadowPath = nil
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {

+ 22 - 0
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/guideMeasure.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "filename" : "What's New-Measure.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "filename" : "What's New-Measure 1.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/guideMeasure.imageset/What's New-Measure 1.pdf


BIN
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/guideMeasure.imageset/What's New-Measure.pdf


+ 2 - 0
PDF Office/PDF Master/Class/GuideInfo/KMGuideConfig.swift

@@ -18,6 +18,7 @@ let kKMGuideInfoCustomColorKey   = "kKMGuideInfoCustomColorKey"
 let kKMGuideInfoAIResultSaveKey  = "kKMGuideInfoAIResultSaveKey"
 let kKMGuideInfoAITipIconViewKey  = "kKMGuideInfoAITipIconViewKey"
 let kKMGuideInfoEditPDFPopWindowKey  = "kKMGuideInfoEditPDFPopWindowKey"
+let kKMGuideInfoMeasureKey  = "kKMGuideInfoMeasureKey"
 
 @objc public enum KMGuideInfoType: NSInteger {
     case none = 0
@@ -36,6 +37,7 @@ let kKMGuideInfoEditPDFPopWindowKey  = "kKMGuideInfoEditPDFPopWindowKey"
     case aiInfoResultSave       = 13//AI功能保存操作
     case aiTipIconInfo         = 14//AI按钮
     case editPDFPopWindow       = 15 // 内容编辑悬浮窗口
+    case measureGuide           = 16 // 测量
 }
 
 @objc public enum KMGuideActionType: NSInteger {

+ 33 - 0
PDF Office/PDF Master/Class/GuideInfo/KMGuideInfoWindowController.swift

@@ -67,6 +67,10 @@ class KMGuideInfoWindowController: NSWindowController {
             if (UserDefaults.standard.object(forKey: kKMGuideInfoEditPDFPopWindowKey) == nil) {
                 return true
             }
+        } else if type == .measureGuide {
+            if (UserDefaults.standard.object(forKey: kKMGuideInfoMeasureKey) == nil) {
+                return true
+            }
         }
         return false
     }
@@ -93,6 +97,9 @@ class KMGuideInfoWindowController: NSWindowController {
         } else if type == .editPDFPopWindow {
             UserDefaults.standard.setValue("Show", forKey: kKMGuideInfoEditPDFPopWindowKey)
             UserDefaults.standard.synchronize()
+        } else if type == .measureGuide {
+            UserDefaults.standard.setValue("Show", forKey: kKMGuideInfoMeasureKey)
+            UserDefaults.standard.synchronize()
         }
     }
     
@@ -383,6 +390,10 @@ class KMGuideInfoWindowController: NSWindowController {
                             self.closeAction()
                         }
                     } else if self.type == .pdfCompareGuide {
+                        guard let callBack = self.finishHandle else {
+                            return
+                        }
+                        callBack(self, .windowNewFinish)
                         if actionType == .getIt {
                             self.closeAction()
                         }
@@ -390,6 +401,28 @@ class KMGuideInfoWindowController: NSWindowController {
                 }
                 self.coverView.addSubview(self.openFileFunctionView)
                 self.openFileFunctionView.updateViewColor()
+            } else if self.type == .measureGuide {
+                KMGuideInfoWindowController.setDidShowFor(.measureGuide)
+                
+                if self.openFileFunctionView == nil {
+                    self.openFileFunctionView = KMOpenFileFunctionView.createFromNib()
+                }
+                self.openFileFunctionView.circleRect = self.digitalBoxRect
+                self.openFileFunctionView.frame = self.coverView.bounds
+                self.openFileFunctionView.autoresizingMask = [.width, .height]
+                self.openFileFunctionView.type =  self.type
+                self.openFileFunctionView.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
+                    guard let callBack = self.finishHandle else {
+                        return
+                    }
+                    callBack(self, .windowDigitalFinish)
+                    if actionType == .getIt {
+                        self.closeAction()
+                    }
+                }
+                self.coverView.addSubview(self.openFileFunctionView)
+                self.openFileFunctionView.updateViewColor()
             } else if self.type == .convertGuide {
                 if self.convertGuideView == nil {
                     self.convertGuideView = KMConvertGuideView.createFromNib()

+ 5 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -3651,7 +3651,11 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
             }
             self.enterRedact()
         } else if type == .Tool {
-            self.loadOpenFileFunctionGuide(.pdfCompareGuide)
+            if KMGuideInfoWindowController.availableShow(.pdfCompareGuide) {
+                self.loadOpenFileFunctionGuide(.pdfCompareGuide)
+            } else if KMGuideInfoWindowController.availableShow(.measureGuide) {
+                self.loadOpenFileFunctionGuide(.measureGuide)
+            }
         } else if type == . Conversion {
             self.loadOpenFileFunctionGuide(.convertGuide)
         }else if type == .Form {

+ 33 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -912,6 +912,39 @@ import Cocoa
                 let compareItem:KMToolbarItemView = self.toolbarController.findItem(KMToolbarComparisonItemIdentifier)!
                 guideWC.compareItemRect = (self.view.window?.contentView?.convert(compareItem.frame, from: compareItem.superview))!
                 
+                guideWC.finishHandle = { [weak self] winC, type in
+                    if type == .windowNewFinish {
+                        DispatchQueue.main.async {
+                            self?.loadOpenFileFunctionGuide(.measureGuide)
+                        }
+                        return
+                    }
+                }
+                
+                guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
+                var rect = self.view.window!.frame
+                rect.size.height -= 20
+                guideWC.window?.setFrame(rect, display: false)
+                guideWC.window?.minSize = rect.size
+                guideWC.window?.maxSize = rect.size
+                self.view.window?.addChildWindow(guideWC.window!, ordered: .above)
+                guideWC.show()
+            }
+        } else if showType == .measureGuide && KMGuideInfoWindowController.availableShow(.measureGuide) {
+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
+                self.guideInfoWindowController = KMGuideInfoWindowController.currentWC()
+                guard let guideWC = self.guideInfoWindowController else { return }
+                
+                guideWC.type = .measureGuide
+                
+                guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
+                    return
+                }
+                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview))!
+                
+                let compareItem:KMToolbarItemView = self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)!
+                guideWC.compareItemRect = (self.view.window?.contentView?.convert(compareItem.frame, from: compareItem.superview))!
+                
                 guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
                 var rect = self.view.window!.frame
                 rect.size.height -= 20