Bladeren bron

【幻灯片】退出幻灯片模式后,页面显示变成不连续滚动的效果了

liujiajie 6 maanden geleden
bovenliggende
commit
1086c7e075

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -36,6 +36,7 @@ extern NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotific
 
 extern NSNotificationName const KMPDFViewTableAnnotationDidChangeNotification;
 
+extern NSNotificationName const CPDFListViewDisplayModeChangeNotification;
 
 typedef NS_ENUM(NSInteger, CPDFViewSidebarSpeedMode) {
     CPDFViewSidebarSpeedModeLeft = 0,

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -46,6 +46,8 @@ NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotification =
 
 NSNotificationName const KMPDFViewTableAnnotationDidChangeNotification = @"KMPDFViewTableAnnotationDidChangeNotification";
 
+NSNotificationName const CPDFListViewDisplayModeChangeNotification = @"CPDFListViewDisplayModeChangeNotification";
+
 @implementation CPDFListView
 
 #pragma mark - Init

+ 12 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -5188,21 +5188,33 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
 - (IBAction)menuItemClick_TwoPagesContinuous:(id)sender {
     self.displayViewMode = CPDFDisplayViewTwoUpContinuous;
     [self layoutDocumentView];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewDisplayModeChangeNotification object:self /*userInfo:@{@"viewMode":@"3"}*/];
+    });
 }
 
 - (IBAction)menuItemClick_TwoPages:(id)sender {
     self.displayViewMode = CPDFDisplayViewTwoUp;
     [self layoutDocumentView];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewDisplayModeChangeNotification object:self/* userInfo:@{@"viewMode":@"2"}*/];
+    });
 }
 
 - (IBAction)menuItemClick_SinglePagesContinuous:(id)sender {
     self.displayViewMode = CPDFDisplayViewSinglePageContinuous;
     [self layoutDocumentView];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewDisplayModeChangeNotification object:self/* userInfo:@{@"viewMode":@"1"}*/];
+    });
 }
 
 - (IBAction)menuItemClick_SinglePage:(id)sender {
     self.displayViewMode = CPDFDisplayViewSinglePage;
     [self layoutDocumentView];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewDisplayModeChangeNotification object:self /*userInfo:@{@"viewMode":@"0"}*/];
+    });
 }
 
 - (IBAction)menuItemClick_BookMode:(id)sender {

+ 4 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayPropertiesViewController.swift

@@ -297,6 +297,7 @@ class KMPageDisplayPropertiesButton: NSButton {
         replaceViewTopConstraint.constant = replaceView.isHidden ? -replaceView.bounds.height : 10.0
 
         NotificationCenter.default.addObserver(self, selector: #selector(removeSecondaryPdfContentView(_:)), name: NSNotification.Name("KMSplitSinglePageNotification"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(viewModeChangeUpdateState(_:)), name: Notification.Name("CPDFListViewDisplayModeChangeNotification"), object: nil)
     }
     
     private func reloadReplaceView() {
@@ -612,7 +613,9 @@ class KMPageDisplayPropertiesButton: NSButton {
         replaceView.isHidden = true
         replaceViewTopConstraint.constant = replaceView.isHidden ? -replaceView.bounds.height : 10.0
     }
-
+    @objc func viewModeChangeUpdateState(_ notification: Notification?) {
+        reloadData()
+    }
 }
 
 extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCollectionViewDataSource {

+ 3 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -823,10 +823,12 @@ extension KMMainViewController {
 //        [scrollView setHasHorizontalScroller:[[savedNormalSetup objectForKey:HASHORIZONTALSCROLLER_KEY] boolValue]];
 //        [scrollView setHasVerticalScroller:[[savedNormalSetup objectForKey:HASVERTICALSCROLLER_KEY] boolValue]];
 //        [scrollView setAutohidesScrollers:[[savedNormalSetup objectForKey:AUTOHIDESSCROLLERS_KEY] boolValue]];
+        self.selectDisplay(display: KMPDFDisplayType(rawValue: KMPDFDisplayType.RawValue(self.listView.fetchDisplayViewMode().rawValue)) ?? .singlePage, viewSettingIsReload: false)
+//        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CPDFListViewDisplayModeChangeNotification"), object: nil)
     }
     
     func currentPDFSettings() -> NSDictionary {
-        var setup = NSMutableDictionary()
+        let setup = NSMutableDictionary()
         setup[KMMainModel.Key.kDisplaysPageBreaks] = NSNumber(value: listView.displaysPageBreaks)
         setup[KMMainModel.Key.kDisplaysAsBook] = NSNumber(value: listView.displaysAsBook)
         setup[KMMainModel.Key.kDisplayBox] = NSNumber(value: listView.displayBox.rawValue)