Browse Source

【注释】文本单选 样式名称对比优化

lizhe 1 year ago
parent
commit
ec27ac3f8e

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.h

@@ -27,6 +27,7 @@ typedef void(^KMAnnotationSelfSignViewControllerCallBack)(CAnnotationType newTyp
 - (void)updateTextPresupposition:(NSString *)fontName size:(CGFloat)size needChangeListView:(BOOL)needChangeListView;
 - (void)updateFontNameAndStyle:(NSString *)name style:(NSString *)style needChangeListView:(BOOL)needChangeListView needSave:(BOOL)needSave;
 - (void)updateFontSize:(CGFloat)size needChangeListView:(BOOL)needChangeListView needSave:(BOOL)needSave;
+- (void)updateTextTextPresuppositionState:(NSString *)name size:(CGFloat)size;
 
 - (void)resetTextPresuppositionData;
 - (void)reDefineTextPresuppositionData:(BOOL)redefine;

+ 21 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.m

@@ -1512,6 +1512,8 @@
             
             [self updateFontSize:fontSize needChangeListView:NO needSave:NO];
             [self updateFontNameAndStyle:fontName  style:fontStyle needChangeListView:NO needSave:NO];
+        
+            [self updateTextTextPresuppositionState:currentFont.fontName size:fontSize];
 //        }
     } else {
         KMEditPDFTextFontModel *model = [KMEditPDFTextManager.manager fetchUserDefaultDataWithTypeStringWithType:@"Commonly"];
@@ -2159,6 +2161,7 @@
 - (void)updateTextPresupposition:(NSString *)fontName size:(CGFloat)size needChangeListView:(BOOL)needChangeListView;
 - (void)updateFontNameAndStyle:(NSString *)name style:(NSString *)style needChangeListView:(BOOL)needChangeListView needSave:(BOOL)needSave;
 - (void)updateFontSize:(CGFloat)size needChangeListView:(BOOL)needChangeListView needSave:(BOOL)needSave;
+- (void)updateTextTextPresuppositionState:(NSString *)name size:(CGFloat)size;
 
 - (void)resetTextPresuppositionData;
 - (void)reDefineTextPresuppositionData:(BOOL)redefine;
@@ -2169,6 +2172,24 @@
 
 }
 
+- (void)updateTextTextPresuppositionState:(NSString *)name size:(CGFloat)size {
+    NSString *fontName = [KMEditPDFTextManager.manager transformAreaTextFontNameWithFontName:name fontNames:self.fontNameVC.items];
+    NSArray *dataArray = [KMEditPDFTextManager.manager fetchAllUserDefaultData];
+    
+    NSInteger index = 0;
+    for (int i = 0; i < dataArray.count; i++) {
+        KMEditPDFTextFontModel *model = dataArray[i];
+        if (model.fontName == fontName && model.fontSize == size) {
+            index = i;
+            break;
+        }
+    }
+    
+    //刷新样式
+    [self.textPresuppositionVC addItemsWithObjectValues:[KMEditPDFTextManager.manager updateTextPresuppositionFontNameArray]];
+    [self.textPresuppositionVC selectItemAt:index];
+}
+
 - (void)updateTextPresupposition:(NSString *)type needChangeListView:(BOOL) needChangeListView {
     NSInteger index = [KMEditPDFTextFontTypeWrapper.allValues indexOfObject:type];
     KMEditPDFTextFontModel *model = [KMEditPDFTextManager.manager fetchAllUserDefaultData][index];