Ver código fonte

【工具栏】左侧icon之间 缺少分割线;主工具栏需要整体居中显示(已修复)

tangchao 1 ano atrás
pai
commit
c9364dd79d

+ 13 - 4
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbar.m

@@ -709,7 +709,12 @@ NSString *KMToolbarDividerItemIdentifier = @"KMToolbarDividerItemIdentifier";
 
 - (void)updateMainView
 {
+    NSView *centerView = [[NSView alloc] init];
+    [self addSubview:centerView];
+    
     NSView *leftView = [[NSView alloc] init];
+    leftView.wantsLayer = YES;
+    leftView.layer.backgroundColor = [NSColor colorWithRed:247/255.f green:248/255.f blue:250/255.f alpha:1.f].CGColor;
     [self addSubview:leftView];
     [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.equalTo(self.mas_left).offset(0);
@@ -772,6 +777,8 @@ NSString *KMToolbarDividerItemIdentifier = @"KMToolbarDividerItemIdentifier";
     
     NSView *rightView = [[NSView alloc] init];
     [self addSubview:rightView];
+    rightView.wantsLayer = YES;
+    rightView.layer.backgroundColor = [NSColor colorWithRed:247/255.f green:248/255.f blue:250/255.f alpha:1.f].CGColor;
     [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.equalTo(self.mas_right).offset(0);
         make.top.equalTo(self.mas_top).offset(0);
@@ -831,14 +838,16 @@ NSString *KMToolbarDividerItemIdentifier = @"KMToolbarDividerItemIdentifier";
         rightlastItem = item;
     }
     
-    NSView *centerView = [[NSView alloc] init];
-    [self addSubview:centerView];
+//    NSView *centerView = [[NSView alloc] init];
+//    [self addSubview:centerView];
     
     [centerView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.right.equalTo(rightView.mas_left).offset(0);
+//        make.right.equalTo(rightView.mas_left).offset(0);
+        make.right.mas_equalTo(0);
         make.top.equalTo(self.mas_top).offset(0);
         make.bottom.equalTo(self.mas_bottom).offset(0);
-        make.left.equalTo(leftView.mas_right).offset(0);
+//        make.left.equalTo(leftView.mas_right).offset(0);
+        make.left.mas_equalTo(0);
     }];
     
     if(!self.contentView.superview) {

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -357,10 +357,10 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
 extension KMToolbarViewController : KMNewToolbarDelegate,NSToolbarItemValidation {
     func toolbarLeftDefaultItemIdentifiers(_ toolbar: KMToolbar!) -> [String]! {
         if toolbarType == .Main {
-            return [KMLeftControlToolbarItemIdentifier,
+            return [KMLeftControlToolbarItemIdentifier, KMToolbarDividerItemIdentifier,
                     KMDocumentZoomToolbarItemIdentifier,
                     KMDocumentZoomOutToolbarItemIdentifier,
-                    KMDocumentZoomViewToolbarItemIdentifier,
+                    KMDocumentZoomViewToolbarItemIdentifier, KMToolbarDividerItemIdentifier,
                     KMDocumentPreviousPageToolbarItemIdentifier,
                     KMDocumentNextPageToolbarItemIdentifier]
         }