Browse Source

【BOTA】左侧菜单栏高保真补充

lizhe 2 years ago
parent
commit
36dccc511b

+ 1 - 1
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.swift

@@ -291,7 +291,7 @@ extension KMBookMarkViewController : NSTableViewDelegate,NSTableViewDataSource {
             }
         }
         rowView.addSubview(rightBox)
-        rowView.selectionColor = NSColor(hex: "#CED0D499")
+        rowView.selectionColor = NSColor(hex: "#EDEEF0")
         
         return rowView
     }

+ 1 - 1
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.xib

@@ -147,7 +147,7 @@
                                             </subviews>
                                         </clipView>
                                         <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="UbR-Pn-9tg">
-                                            <rect key="frame" x="1" y="287" width="260" height="15"/>
+                                            <rect key="frame" x="1" y="238" width="258" height="15"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                         </scroller>
                                         <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Ali-DJ-95W">

+ 4 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -346,9 +346,13 @@ extension KMLeftSideViewController: NSTableViewDelegate,NSTableViewDataSource {
         let cell : KMLiftSideCellView = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMLiftSideCellView"), owner: self) as! KMLiftSideCellView
         if row <= selectImage.count-1 {
             if self.dataSource[row] == self.type {
+                cell.isSelect = true
                 cell.mothedImage.image = NSImage(named: selectImage[row])
+                cell.backgroundColor(NSColor(hex: "#DFE1E5"))
             } else {
+                cell.isSelect = false
                 cell.mothedImage.image = NSImage(named: norImage[row])
+                cell.backgroundColor(NSColor.clear)
             }
         }
         cell.index = row

+ 12 - 12
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.xib

@@ -20,24 +20,24 @@
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="kP6-mo-Sz6">
-                    <rect key="frame" x="0.0" y="0.0" width="48" height="308"/>
+                    <rect key="frame" x="0.0" y="0.0" width="48" height="296"/>
                     <view key="contentView" id="Q4W-NP-64T">
-                        <rect key="frame" x="0.0" y="0.0" width="48" height="308"/>
+                        <rect key="frame" x="0.0" y="0.0" width="48" height="296"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <scrollView autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aU7-b6-SiZ">
-                                <rect key="frame" x="0.0" y="0.0" width="48" height="308"/>
+                                <rect key="frame" x="0.0" y="0.0" width="48" height="296"/>
                                 <clipView key="contentView" drawsBackground="NO" id="aGL-wm-zkF">
-                                    <rect key="frame" x="1" y="1" width="46" height="306"/>
+                                    <rect key="frame" x="1" y="1" width="46" height="294"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
-                                        <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="dGj-Se-plG">
-                                            <rect key="frame" x="0.0" y="0.0" width="52" height="306"/>
+                                        <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="dGj-Se-plG">
+                                            <rect key="frame" x="0.0" y="0.0" width="46" height="294"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                             <color key="gridColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                             <tableColumns>
-                                                <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="40" minWidth="40" maxWidth="1000" id="KwS-0B-ySc">
+                                                <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="46" minWidth="40" maxWidth="1000" id="KwS-0B-ySc">
                                                     <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
                                                         <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                         <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -50,15 +50,15 @@
                                                     <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                     <prototypeCellViews>
                                                         <tableCellView identifier="KMLiftSideCellView" misplaced="YES" id="mYU-nI-1MW" customClass="KMLiftSideCellView" customModule="PDF_Office" customModuleProvider="target">
-                                                            <rect key="frame" x="0.0" y="0.0" width="52" height="24"/>
+                                                            <rect key="frame" x="0.0" y="0.0" width="46" height="24"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <subviews>
                                                                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Ybw-KZ-WjH">
-                                                                    <rect key="frame" x="-4" y="0.0" width="56" height="20"/>
+                                                                    <rect key="frame" x="-4" y="0.0" width="50" height="20"/>
                                                                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" image="KMImageNameSidebarAnnotationNor" id="Jhb-gj-ABR"/>
                                                                 </imageView>
                                                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bgB-cQ-OUB">
-                                                                    <rect key="frame" x="-4" y="0.0" width="56" height="20"/>
+                                                                    <rect key="frame" x="-4" y="0.0" width="50" height="20"/>
                                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="b9y-Sd-KWO">
                                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                                         <font key="font" metaFont="system"/>
@@ -119,9 +119,9 @@
                     <color key="fillColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                 </box>
                 <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="AX3-hJ-DWi">
-                    <rect key="frame" x="48" y="0.0" width="148" height="308"/>
+                    <rect key="frame" x="48" y="0.0" width="148" height="296"/>
                     <view key="contentView" id="hw8-Bc-FEV">
-                        <rect key="frame" x="0.0" y="0.0" width="148" height="308"/>
+                        <rect key="frame" x="0.0" y="0.0" width="148" height="296"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                     </view>
                 </box>

+ 30 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/KMLiftSideCellView.swift

@@ -8,10 +8,18 @@
 import Cocoa
 
 class KMLiftSideCellView: NSTableCellView {
+    
+    var box: KMBox?
     typealias selectClick = (_ index: Int) -> ()
     @IBOutlet weak var mothedImage: NSImageView!
     var buttonClick: selectClick?
     var index = 0
+    var isSelect: Bool = false
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        self.addBox()
+    }
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
         
@@ -20,4 +28,26 @@ class KMLiftSideCellView: NSTableCellView {
     @IBAction func updateLeftStyle(_ sender: Any) {
         self.buttonClick?(index)
     }
+    
+    func addBox() {
+        if self.box == nil {
+            self.box?.wantsLayer = true
+            self.box = KMBox(frame: self.bounds)
+            self.box?.borderWidth = 0
+            self.box?.boxType = .custom
+            self.addSubview(self.box!)
+            self.box?.moveCallback = { [unowned self] (mouseEntered, mouseBox) in
+                if mouseEntered {
+                    self.backgroundColor(NSColor(hex: "#DFE1E5"))
+                } else {
+                    if !isSelect {
+                        self.backgroundColor(NSColor.clear)
+                    }
+                }
+            }
+            self.box?.autoresizingMask = [.width, .height]
+        } else {
+            self.box!.frame = self.bounds
+        }
+    }
 }