fix: don't show ui on fast trigger

This commit is contained in:
louis.pontoise authored and lwouis committed 2020-03-10 14:00:37 +09:00
1 parent b8d6bc999f
commit f8e1b00985
2 files changed
+11 -11

No files matched your search

+2 -2
View File
@@ -93,7 +93,7 @@ class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
Windows.focusedWindowIndex = 0
Windows.cycleFocusedWindowIndex(step)
refreshOpenUi()
thumbnailsPanel?.show()
if uiWorkShouldBeDone { thumbnailsPanel?.show() }
} else {
debugPrint("showUiOrCycleSelection: !isFirstSummon")
cycleSelection(step)
@@ -103,7 +103,7 @@ class App: NSApplication, NSApplicationDelegate, NSWindowDelegate {
func refreshOpenUi() {
guard appIsBeingUsed else { return }
let currentScreen = Screen.preferred() // fix screen between steps since it could change (e.g. mouse moved to another screen)
if uiWorkShouldBeDone { thumbnailsPanel!.refreshCollectionView(currentScreen); debugPrint("refreshCollectionView") }
if uiWorkShouldBeDone { thumbnailsPanel!.refreshCollectionView(currentScreen, uiWorkShouldBeDone); debugPrint("refreshCollectionView") }
if uiWorkShouldBeDone { thumbnailsPanel!.highlightCell(); debugPrint("highlightCellAt") }
if uiWorkShouldBeDone { Screen.repositionPanel(thumbnailsPanel!, currentScreen, .appleCentered); debugPrint("repositionPanel") }
}
+9 -9
View File
@@ -97,14 +97,14 @@ class ThumbnailsPanel: NSPanel, NSCollectionViewDataSource, NSCollectionViewDele
}
}
func refreshCollectionView(_ currentScreen: NSScreen) {
self.currentScreen = currentScreen
(collectionView_.collectionViewLayout as! CollectionViewCenterFlowLayout).currentScreen = currentScreen
collectionView_!.setFrameSize(Screen.thumbnailPanelMaxSize(currentScreen))
collectionView_!.reloadData()
collectionView_!.layoutSubtreeIfNeeded()
setContentSize(NSSize(width: collectionView_!.frame.size.width + Preferences.windowPadding * 2, height: collectionView_!.frame.size.height + Preferences.windowPadding * 2))
backgroundView!.setFrameSize(frame.size)
collectionView_!.setFrameOrigin(NSPoint(x: Preferences.windowPadding, y: Preferences.windowPadding))
func refreshCollectionView(_ currentScreen: NSScreen, _ uiWorkShouldBeDone: Bool) {
if uiWorkShouldBeDone { self.currentScreen = currentScreen }
if uiWorkShouldBeDone { (collectionView_.collectionViewLayout as! CollectionViewCenterFlowLayout).currentScreen = currentScreen }
if uiWorkShouldBeDone { collectionView_!.setFrameSize(Screen.thumbnailPanelMaxSize(currentScreen)) }
if uiWorkShouldBeDone { collectionView_!.reloadData() }
if uiWorkShouldBeDone { collectionView_!.layoutSubtreeIfNeeded() }
if uiWorkShouldBeDone { setContentSize(NSSize(width: collectionView_!.frame.size.width + Preferences.windowPadding * 2, height: collectionView_!.frame.size.height + Preferences.windowPadding * 2)) }
if uiWorkShouldBeDone { backgroundView!.setFrameSize(frame.size) }
if uiWorkShouldBeDone { collectionView_!.setFrameOrigin(NSPoint(x: Preferences.windowPadding, y: Preferences.windowPadding)) }
}
}