|
@@ -131,7 +131,7 @@ extension KMBrowserWindowController {
|
|
|
|
|
|
if let mainVc = (self.document as? KMMainDocument)?.mainViewController {
|
|
|
mainVc.fadeInFullScreenWindow(with: backgroundColor, level: level.rawValue)
|
|
|
- mainVc.enterPresentation()
|
|
|
+ mainVc.enterPresentationMode()
|
|
|
mainVc.fadeInFullScreenView(mainVc.listView, inset: 0)
|
|
|
}
|
|
|
|
|
@@ -176,12 +176,11 @@ extension KMBrowserWindowController {
|
|
|
if wasInteractionMode == .SKLegacyFullScreenMode {
|
|
|
let doc = self.document as? KMMainDocument
|
|
|
view = doc?.mainViewController?.pdfSplitView
|
|
|
-// contentView = centerContentView;
|
|
|
contentView = doc?.mainViewController?.centerContentView
|
|
|
} else {
|
|
|
let doc = self.document as? KMMainDocument
|
|
|
view = doc?.mainViewController?.listView
|
|
|
- contentView = doc?.mainViewController?.PDFContendView
|
|
|
+ contentView = doc?.mainViewController?.readContentView
|
|
|
}
|
|
|
|
|
|
self.hideLeftSideWindow()
|
|
@@ -190,13 +189,20 @@ extension KMBrowserWindowController {
|
|
|
// do this first, otherwise the navigation window may be covered by fadeWindow and then reveiled again, which looks odd
|
|
|
// [pdfView setInteractionMode:SKNormalMode];
|
|
|
//
|
|
|
-// [self fadeOutFullScreenView:view];
|
|
|
-
|
|
|
// this should be done before exitPresentationMode to get a smooth transition
|
|
|
- view?.frame = contentView?.bounds ?? .zero
|
|
|
-// [contentView addSubview:view];
|
|
|
if let v = view {
|
|
|
+ self.fadeOutFullScreenView(v)
|
|
|
+ view?.frame = contentView?.bounds ?? .zero
|
|
|
contentView?.addSubview(v)
|
|
|
+ v.mas_makeConstraints { make in
|
|
|
+ make?.left.mas_equalTo()(0)
|
|
|
+ make?.right.mas_equalTo()(0)
|
|
|
+ make?.top.mas_equalTo()(0)
|
|
|
+ make?.bottom.mas_equalTo()(0)
|
|
|
+ }
|
|
|
+
|
|
|
+ (v as? CPDFListView)?.layoutDocumentView()
|
|
|
+ (v as? CPDFListView)?.requiresDisplay()
|
|
|
}
|
|
|
|
|
|
if let mainVc = (self.document as? KMMainDocument)?.mainViewController {
|
|
@@ -219,7 +225,7 @@ extension KMBrowserWindowController {
|
|
|
// if (_isShowToolbar) {
|
|
|
// [self.toolbarViewController hiddenToolbar:NO];
|
|
|
// }
|
|
|
-// [self fadeOutFullScreenWindow];
|
|
|
+ self.fadeOutFullScreenWindow()
|
|
|
|
|
|
// the page number may have changed
|
|
|
self.synchronizeWindowTitleWithDocumentName()
|
|
@@ -261,4 +267,58 @@ extension KMBrowserWindowController {
|
|
|
// [blankingWindows makeObjectsPerformSelector:@selector(fadeOut)];
|
|
|
// blankingWindows = nil;
|
|
|
}
|
|
|
+
|
|
|
+ func fadeOutFullScreenView(_ view: NSView) {
|
|
|
+ guard let fullScreenWindow = self.window as? KMFullScreenWindow else {
|
|
|
+ NSSound.beep()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let fadeWindow = KMFullScreenWindow(screen: fullScreenWindow.screen ?? NSScreen.main!, bgColor: fullScreenWindow.backgroundColor, level: fullScreenWindow.level.rawValue, isMain: false)
|
|
|
+
|
|
|
+ fadeWindow.alphaValue = 0
|
|
|
+ fadeWindow.order(.above, relativeTo: fullScreenWindow.windowNumber)
|
|
|
+ fadeWindow.fadeInBlocking()
|
|
|
+ view.removeFromSuperview()
|
|
|
+ fullScreenWindow.display()
|
|
|
+ fullScreenWindow.delegate = nil
|
|
|
+ fullScreenWindow.makeFirstResponder(nil)
|
|
|
+ fadeWindow.orderOut(nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ func fadeOutFullScreenWindow() {
|
|
|
+ guard let fullScreenWindow = self.window as? KMFullScreenWindow else {
|
|
|
+ NSSound.beep()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let mainVc = (self.document as? KMMainDocument)?.mainViewController
|
|
|
+ let mainWindow = mainVc?.mainWindow
|
|
|
+ let collectionBehavior = mainWindow?.collectionBehavior
|
|
|
+
|
|
|
+ self.window = mainWindow
|
|
|
+ mainWindow?.alphaValue = 0
|
|
|
+ if let data = mainWindow?.responds(to: NSSelectorFromString("setAnimationBehavior:")), data {
|
|
|
+ mainWindow?.animationBehavior = .none
|
|
|
+ }
|
|
|
+ // trick to make sure the main window shows up in the same space as the fullscreen window
|
|
|
+ fullScreenWindow.addChildWindow(mainWindow!, ordered: .below)
|
|
|
+ fullScreenWindow.removeChildWindow(mainWindow!)
|
|
|
+ fullScreenWindow.level = .popUpMenu
|
|
|
+ // these can change due to the child window trick
|
|
|
+ mainWindow?.level = .normal
|
|
|
+ mainWindow?.alphaValue = 1.0
|
|
|
+ mainWindow?.collectionBehavior = collectionBehavior!
|
|
|
+ mainWindow?.display()
|
|
|
+ mainWindow?.makeFirstResponder(mainVc?.listView)
|
|
|
+ mainWindow?.recalculateKeyViewLoop()
|
|
|
+ mainWindow?.delegate = self
|
|
|
+ mainWindow?.makeKey()
|
|
|
+// [NSApp updatePresentationOptionsForWindow:mainWindow];
|
|
|
+
|
|
|
+ if let data = mainWindow?.responds(to: NSSelectorFromString("setAnimationBehavior:")), data {
|
|
|
+ mainWindow?.animationBehavior = .default
|
|
|
+ }
|
|
|
+ NSApp.removeWindowsItem(fullScreenWindow)
|
|
|
+ fullScreenWindow.fadeOut()
|
|
|
+ }
|
|
|
}
|