Browse Source

【2025】首页快捷工具滚动条优化

niehaoyu 5 months ago
parent
commit
a774802244

+ 8 - 1
PDF Office/PDF Master/KMClass/KMHomeViewController/KMNHomeViewController.swift

@@ -28,6 +28,14 @@ class KMNHomeViewController: NSViewController {
         self.initAdvertisementData()
     }
     
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        
+        
+        self.rightInfoView.resetScrollerStyle()
+        
+    }
+    
     func configLeftContendView() {
         
         leftContendBox.fillColor = ComponentLibrary.shared.getComponentColorFromKey("colorBg/layout-middle")
@@ -38,7 +46,6 @@ class KMNHomeViewController: NSViewController {
     
     func configRightContendView() {
         
-        rightInfoView.scrollView.scrollerStyle = .overlay
         rightInfoView.delegate = self
         rightInfoView.reloadData()
         

+ 10 - 8
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift

@@ -54,6 +54,10 @@ public class KMHomeQuickToolsView: BaseXibView {
         self.setupUI()
     }
     
+    public func resetScrollerStyle() {
+         self.scrollView.scrollerStyle = .overlay
+     }
+    
     func setupUI() {
         
         titleLabel.stringValue = KMLocalizedString("Quick Tools")
@@ -70,19 +74,17 @@ public class KMHomeQuickToolsView: BaseXibView {
         moreButton.setTarget(self, action: #selector(moreButtonClicked(_:)))
         
         
-        scrollView.scrollerStyle = .overlay
-//        scrollView.horizontalScroller = nil
-        
         collectionView.backgroundColors = [NSColor.clear]
         collectionView.wantsLayer = true
         collectionView.layer?.backgroundColor = NSColor.clear.cgColor
         collectionView.delegate = self
         collectionView.dataSource = self
- 
         collectionView.register(KMHomeQuickToolsItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMHomeQuickToolsItem"))
         
-        
-        
+    }
+    
+    public func reloadData() {
+        self.collectionView.reloadData()
     }
     
     //MARK: - Action
@@ -152,11 +154,11 @@ extension KMHomeQuickToolsView: NSCollectionViewDelegate, NSCollectionViewDataSo
     }
     
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
-        return 0
+        return CGRectGetHeight(collectionView.frame) - 60 * 2 - 2
     }
     
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, insetForSectionAt section: Int) -> NSEdgeInsets {
-        return NSEdgeInsetsMake(0, 0, 0, 0)
+        return NSEdgeInsetsMake(0.01, 0.01, 0.01, 0.01)
     }
     
     public func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>) {

+ 10 - 10
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.xib

@@ -18,20 +18,20 @@
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="c22-O7-iKe">
-            <rect key="frame" x="0.0" y="0.0" width="480" height="264"/>
+            <rect key="frame" x="0.0" y="0.0" width="480" height="204"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="6Sr-Sn-Npw">
-                    <rect key="frame" x="40" y="0.0" width="400" height="232"/>
+                    <rect key="frame" x="40" y="0.0" width="400" height="172"/>
                     <view key="contentView" id="JjO-Lz-hL8">
-                        <rect key="frame" x="0.0" y="0.0" width="400" height="232"/>
+                        <rect key="frame" x="0.0" y="0.0" width="400" height="172"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="AfO-5i-mBA">
-                                <rect key="frame" x="0.0" y="204" width="400" height="28"/>
+                                <rect key="frame" x="0.0" y="148" width="400" height="24"/>
                                 <subviews>
                                     <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QbD-Me-hYz">
-                                        <rect key="frame" x="-2" y="6" width="75" height="16"/>
+                                        <rect key="frame" x="-2" y="4" width="75" height="16"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Quick Tools" id="j7h-4X-zZe">
                                             <font key="font" usesAppearanceFont="YES"/>
                                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -39,7 +39,7 @@
                                         </textFieldCell>
                                     </textField>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="N5c-sG-bzx" customClass="ComponentButton" customModule="KMComponentLibrary">
-                                        <rect key="frame" x="376" y="2" width="24" height="24"/>
+                                        <rect key="frame" x="376" y="0.0" width="24" height="24"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="24" id="fVw-8z-7Ps"/>
                                             <constraint firstAttribute="width" constant="24" id="rSm-3T-9fL"/>
@@ -51,17 +51,17 @@
                                     <constraint firstItem="QbD-Me-hYz" firstAttribute="leading" secondItem="AfO-5i-mBA" secondAttribute="leading" id="Unf-I7-NN4"/>
                                     <constraint firstAttribute="trailing" secondItem="N5c-sG-bzx" secondAttribute="trailing" id="atj-X6-6EX"/>
                                     <constraint firstItem="QbD-Me-hYz" firstAttribute="centerY" secondItem="AfO-5i-mBA" secondAttribute="centerY" id="tEE-85-Dmm"/>
-                                    <constraint firstAttribute="height" constant="28" id="ua7-um-ynK"/>
+                                    <constraint firstAttribute="height" constant="24" id="ua7-um-ynK"/>
                                 </constraints>
                             </customView>
                             <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t7Y-2J-HtN">
-                                <rect key="frame" x="0.0" y="0.0" width="400" height="192"/>
+                                <rect key="frame" x="0.0" y="0.0" width="400" height="136"/>
                                 <clipView key="contentView" id="jAB-p4-aXz">
-                                    <rect key="frame" x="0.0" y="0.0" width="400" height="192"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="400" height="136"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
                                         <collectionView allowsEmptySelection="NO" id="OzO-QD-Zq7">
-                                            <rect key="frame" x="0.0" y="0.0" width="400" height="192"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="400" height="136"/>
                                             <autoresizingMask key="autoresizingMask" heightSizable="YES"/>
                                             <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" scrollDirection="horizontal" id="Ee9-dL-M9B">
                                                 <size key="itemSize" width="50" height="50"/>

+ 13 - 7
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/KMHomeRightView.swift

@@ -58,11 +58,18 @@ public class KMHomeRightView: BaseXibView {
         collectionView.reloadData()
     }
     
-    func configUI() {
-        
+    public func resetScrollerStyle() {
         
-        scrollView.scrollerStyle = .overlay
+        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
+            self.scrollView.scrollerStyle = .overlay
+            
+            self.quickToolsView.resetScrollerStyle()
+        }
+    }
+    
+    func configUI() {
         
+
         collectionView.backgroundColors = [NSColor.clear]
         collectionView.wantsLayer = true
         collectionView.layer?.backgroundColor = NSColor.clear.cgColor
@@ -73,7 +80,6 @@ public class KMHomeRightView: BaseXibView {
         collectionView.register(KMHistoryFileThumbItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMHistoryFileThumbItem"))
         collectionView.register(KMHistoryFileListItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMHistoryFileListItem"))
 
-        
         collectionView.register(KMHomeQuickToolsView.self, forSupplementaryViewOfKind: NSCollectionView.elementKindSectionHeader, withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "kmHomeQuickToolsView"))
         collectionView.register(KMHomeFilesHeaderView.self, forSupplementaryViewOfKind: NSCollectionView.elementKindSectionHeader, withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "kmHomeFilesHeaderView"))
         
@@ -234,8 +240,8 @@ extension KMHomeRightView: NSCollectionViewDelegate, NSCollectionViewDataSource,
      
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> NSSize {
         if section == 0 {
-            return NSSize(width: collectionView.frame.size.width, height: 220) //折叠
-//            return NSSize(width: collectionView.frame.size.width, height: 280)
+            return NSSize(width: collectionView.frame.size.width, height: 172+32+2) //折叠
+//            return NSSize(width: collectionView.frame.size.width, height: 228+32)
         } else if section == 1 {
             return NSSize(width: collectionView.frame.size.width, height: 28)
         }
@@ -245,7 +251,7 @@ extension KMHomeRightView: NSCollectionViewDelegate, NSCollectionViewDataSource,
     
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, referenceSizeForFooterInSection section: Int) -> NSSize {
         if section == 0 {
-            return NSSize(width: 0, height: 24)
+            return NSSize(width: 0, height: 40-16)
         }
         return NSSize(width: 0, height: 0.01)
         

+ 2 - 2
PDF Office/PDF Master/KMClass/KMHomeViewController/Views/KMHomeRightView/KMHomeRightView.xib

@@ -35,8 +35,8 @@
                                         <collectionView selectable="YES" allowsMultipleSelection="YES" id="5OB-sb-Wo4">
                                             <rect key="frame" x="0.0" y="0.0" width="402" height="286"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
-                                            <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="EPd-CT-cRT">
-                                                <size key="itemSize" width="50" height="50"/>
+                                            <collectionViewFlowLayout key="collectionViewLayout" id="EPd-CT-cRT">
+                                                <size key="itemSize" width="1" height="1"/>
                                             </collectionViewFlowLayout>
                                             <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </collectionView>

+ 5 - 130
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -23,142 +23,17 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "0175DC15-7784-43C8-AEA2-957111D84A14"
+            uuid = "6BE72FD6-BBA7-4977-B05A-47C1075B9F91"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
+            filePath = "PDF Master/Class/Home/View/KMToolSetScroller.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "177"
-            endingLineNumber = "177"
-            landmarkName = "componentGroupDidSelect(group:menuItemProperty:)"
+            startingLineNumber = "31"
+            endingLineNumber = "31"
+            landmarkName = "init(frame:)"
             landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "0175DC15-7784-43C8-AEA2-957111D84A14 - a3eda8e31822ec3f"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.componentGroupDidSelect(group: Swift.Optional&lt;KMComponentLibrary.ComponentGroup&gt;, menuItemProperty: Swift.Optional&lt;KMComponentLibrary.ComponentMenuitemProperty&gt;) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "176"
-                  endingLineNumber = "176"
-                  offsetFromSymbolStart = "608">
-               </Location>
-               <Location
-                  uuid = "0175DC15-7784-43C8-AEA2-957111D84A14 - a3eda8e31822ec3f"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.componentGroupDidSelect(group: Swift.Optional&lt;KMComponentLibrary.ComponentGroup&gt;, menuItemProperty: Swift.Optional&lt;KMComponentLibrary.ComponentMenuitemProperty&gt;) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "176"
-                  endingLineNumber = "176"
-                  offsetFromSymbolStart = "96">
-               </Location>
-               <Location
-                  uuid = "0175DC15-7784-43C8-AEA2-957111D84A14 - a3eda8e31822ec7d"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.componentGroupDidSelect(group: Swift.Optional&lt;KMComponentLibrary.ComponentGroup&gt;, menuItemProperty: Swift.Optional&lt;KMComponentLibrary.ComponentMenuitemProperty&gt;) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "178"
-                  endingLineNumber = "178"
-                  offsetFromSymbolStart = "608">
-               </Location>
-               <Location
-                  uuid = "0175DC15-7784-43C8-AEA2-957111D84A14 - a3eda8e31822ec5e"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.componentGroupDidSelect(group: Swift.Optional&lt;KMComponentLibrary.ComponentGroup&gt;, menuItemProperty: Swift.Optional&lt;KMComponentLibrary.ComponentMenuitemProperty&gt;) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "177"
-                  endingLineNumber = "177"
-                  offsetFromSymbolStart = "96">
-               </Location>
-            </Locations>
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "454E67D5-605C-4346-BCC2-925B86498713"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "189"
-            endingLineNumber = "189"
-            landmarkName = "quickToolsItemClicked(_:)"
-            landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "454E67D5-605C-4346-BCC2-925B86498713 - 30ce2d623b05bfe2"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.quickToolsItemClicked(PDF_Reader_Pro.KMHomeQuickToolsItem) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "188"
-                  endingLineNumber = "188"
-                  offsetFromSymbolStart = "56">
-               </Location>
-               <Location
-                  uuid = "454E67D5-605C-4346-BCC2-925B86498713 - 30ce2d623b05bf83"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.quickToolsItemClicked(PDF_Reader_Pro.KMHomeQuickToolsItem) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "189"
-                  endingLineNumber = "189"
-                  offsetFromSymbolStart = "488">
-               </Location>
-               <Location
-                  uuid = "454E67D5-605C-4346-BCC2-925B86498713 - 30ce2d623b05bf83"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMHomeQuickToolsView.quickToolsItemClicked(PDF_Reader_Pro.KMHomeQuickToolsItem) -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMHomeViewController/Views/KMHomeQuickToolsView/KMHomeQuickToolsView.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "189"
-                  endingLineNumber = "189"
-                  offsetFromSymbolStart = "56">
-               </Location>
-            </Locations>
          </BreakpointContent>
       </BreakpointProxy>
    </Breakpoints>