Browse Source

CPDFTools(iOS)-QA_bug 箭头样式的修改以及暗夜模式下的背景色

yangliuhua 1 year ago
parent
commit
437f167743

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.m

@@ -69,7 +69,7 @@
         clearButton.tag = CPDFInkTopToolBarClear;
         clearButton.frame = CGRectMake(4*width, 0, width, height);
         [clearButton setTitle:NSLocalizedString(@"Clear", nil) forState:UIControlStateNormal];
-        [clearButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+        [clearButton setTitleColor:[CPDFColorUtils CPageEditToolbarFontColor] forState:UIControlStateNormal];
         clearButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
         [clearButton addTarget:self action:@selector(buttonItemClicked_Switch:) forControlEvents:UIControlEventTouchUpInside];
         [self addSubview:clearButton];

+ 2 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.m

@@ -186,6 +186,7 @@
     self.startArrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:NSLocalizedString(@"Arrow Style",nil)];
     self.startArrowStyleView.frame = self.view.frame;
     self.startArrowStyleView.delegate = self;
+    self.startArrowStyleView.selectIndex = self.startDrawView.selectIndex;
     self.startArrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self.view addSubview:self.startArrowStyleView];
     [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
@@ -195,6 +196,7 @@
     self.endArrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:NSLocalizedString(@"Arrowtail style",nil)];
     self.endArrowStyleView.frame = self.view.frame;
     self.endArrowStyleView.delegate = self;
+    self.endArrowStyleView.selectIndex = self.endDrawView.selectIndex;
     self.endArrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self.view addSubview:self.endArrowStyleView];
     [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];

+ 11 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -502,6 +502,7 @@
 
 - (void)createPropertyViewController {
     if (CPDFViewAnnotationModeInk == self.selectedIndex) {
+        [self.annotManage setAnnotStyleFromMode:self.pdfListView.annotationMode];
 
         self.propertiesBtn.enabled = NO;
         if (@available(iOS 11.0, *)) {
@@ -783,10 +784,16 @@
             break;
         case CPDFInkTopToolBarUndo: {
             [self.annotManage.pdfListView drawUndo];
+            if (((UIButton *)self.topToolBar.buttonArray[1]).selected) {
+                ((UIButton *)self.topToolBar.buttonArray[1]).backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+            }
         }
             break;
         case CPDFInkTopToolBarRedo: {
             [self.annotManage.pdfListView drawRedo];
+            if (((UIButton *)self.topToolBar.buttonArray[1]).selected) {
+                ((UIButton *)self.topToolBar.buttonArray[1]).backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+            }
         }
             break;
         case CPDFInkTopToolBarClear: {
@@ -817,6 +824,7 @@
     if (annotStyle.isSelectAnnot) {
         [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     } else {
+       
         for (CPDFAnnotationBarButton *button in self.annotationBtns) {
              if (CPDFViewAnnotationModeInk == button.tag) {
                 button.lineColor = CAnnotationManage.freehandAnnotationColor;
@@ -830,6 +838,9 @@
 - (void)inkViewControllerDimiss:(CPDFInkViewController *)inkViewController {
     if ([self.topToolBar isDescendantOfView:self.pdfListView]) {
         ((UIButton *)self.topToolBar.buttonArray[0]).backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+        if (((UIButton *)self.topToolBar.buttonArray[1]).selected) {
+            ((UIButton *)self.topToolBar.buttonArray[1]).backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+        }
     }
 }
 

+ 2 - 2
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleCell.m

@@ -21,8 +21,8 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
         self.contextView = [[CPDFDrawArrowView alloc] initWithFrame:CGRectMake(1, 1, self.bounds.size.width - 2, self.bounds.size.height - 2)];
-        self.contextView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
-        self.contentView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+        self.contextView.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
+        self.contentView.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
         [self addSubview:self.contextView];
     }
     return self;

+ 2 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleView.h

@@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, weak) id<CPDFArrowStyleViewDelegate> delegate;
 
+@property (nonatomic, assign) NSInteger selectIndex;
+
 - (instancetype)initWirhTitle:(NSString *)title;
 
 @end

+ 6 - 2
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleView.m

@@ -47,6 +47,7 @@
         
         self.titleLabel = [[UILabel alloc] init];
         self.titleLabel.text = title;
+        self.titleLabel.textAlignment = NSTextAlignmentCenter;
         [self.headerView addSubview:self.titleLabel];
         
         UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
@@ -70,7 +71,7 @@
 - (void)layoutSubviews {
     [super layoutSubviews];
     self.backBtn.frame = CGRectMake(15, 5, 60, 50);
-    self.titleLabel.frame = CGRectMake((self.frame.size.width - 100)/2, 5, 100, 50);
+    self.titleLabel.frame = CGRectMake((self.frame.size.width - 150)/2, 5, 150, 50);
     self.headerView.frame = CGRectMake(0, 0, self.bounds.size.width, 50);
 }
 
@@ -95,6 +96,9 @@
 
 - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
     CPDFArrowStyleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
+    if (self.selectIndex == indexPath.item) {
+        cell.contextView.backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+    }
     cell.contextView.selectIndex = indexPath.item;
     [cell.contentView setNeedsDisplay];
     cell.backgroundColor = [UIColor clearColor];
@@ -106,7 +110,7 @@
 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
     NSArray<UICollectionViewCell *> *cells = [collectionView visibleCells];
     for (UICollectionViewCell *cell in cells) {
-        ((CPDFArrowStyleCell *)cell).contextView.backgroundColor = [UIColor whiteColor];
+        ((CPDFArrowStyleCell *)cell).contextView.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
     }
     CPDFArrowStyleCell *cell = (CPDFArrowStyleCell *)[collectionView cellForItemAtIndexPath:indexPath];
     cell.contextView.backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];