fix: fade-out animation was broken from macos 11 (#760)

This commit is contained in:
Zachary Wander authored and Louis Pontoise committed 2022-06-01 01:22:15 +09:00
1 parent 82e9ca93b6
commit d701bc7347
2 files changed
+12 -4

No files matched your search

+11 -3
View File
@@ -8,7 +8,7 @@ class ThumbnailsPanel: NSPanel, NSWindowDelegate {
self.init(contentRect: .zero, styleMask: .nonactivatingPanel, backing: .buffered, defer: false) self.init(contentRect: .zero, styleMask: .nonactivatingPanel, backing: .buffered, defer: false)
delegate = self delegate = self
isFloatingPanel = true isFloatingPanel = true
updateFadeOutAnimation() animationBehavior = .none
hidesOnDeactivate = false hidesOnDeactivate = false
hasShadow = false hasShadow = false
titleVisibility = .hidden titleVisibility = .hidden
@@ -35,11 +35,19 @@ class ThumbnailsPanel: NSPanel, NSWindowDelegate {
} }
} }
func updateFadeOutAnimation() { override func orderOut(_ sender: Any?) {
animationBehavior = Preferences.fadeOutAnimation ? .utilityWindow : .none if Preferences.fadeOutAnimation {
NSAnimationContext.runAnimationGroup(
{ _ in animator().alphaValue = 0 },
completionHandler: { super.orderOut(sender) }
)
} else {
super.orderOut(sender)
}
} }
func show() { func show() {
alphaValue = 1
makeKeyAndOrderFront(nil) makeKeyAndOrderFront(nil)
MouseEvents.toggle(true) MouseEvents.toggle(true)
thumbnailsView.scrollView.flashScrollers() thumbnailsView.scrollView.flashScrollers()
@@ -24,7 +24,7 @@ class AppearanceTab {
LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Window title truncation:", comment: ""), "titleTruncation", TitleTruncationPreference.allCases), LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Window title truncation:", comment: ""), "titleTruncation", TitleTruncationPreference.allCases),
LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Show on:", comment: ""), "showOnScreen", ShowOnScreenPreference.allCases), LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Show on:", comment: ""), "showOnScreen", ShowOnScreenPreference.allCases),
LabelAndControl.makeLabelWithSlider(NSLocalizedString("Apparition delay:", comment: ""), "windowDisplayDelay", 0, 2000, 11, false, "ms"), LabelAndControl.makeLabelWithSlider(NSLocalizedString("Apparition delay:", comment: ""), "windowDisplayDelay", 0, 2000, 11, false, "ms"),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Fade out animation:", comment: ""), "fadeOutAnimation", extraAction: { _ in App.app.thumbnailsPanel.updateFadeOutAnimation() }), LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Fade out animation:", comment: ""), "fadeOutAnimation"),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Hide Space number labels:", comment: ""), "hideSpaceNumberLabels"), LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Hide Space number labels:", comment: ""), "hideSpaceNumberLabels"),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Hide status icons:", comment: ""), "hideStatusIcons"), LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Hide status icons:", comment: ""), "hideStatusIcons"),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Show standard tabs as windows:", comment: ""), "showTabsAsWindows"), LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Show standard tabs as windows:", comment: ""), "showTabsAsWindows"),