diff --git a/src/ui/main-window/ThumbnailsPanel.swift b/src/ui/main-window/ThumbnailsPanel.swift index 1b7e35f5..29f8255a 100644 --- a/src/ui/main-window/ThumbnailsPanel.swift +++ b/src/ui/main-window/ThumbnailsPanel.swift @@ -40,9 +40,12 @@ class ThumbnailsPanel: NSPanel { guard App.app.appIsBeingUsed else { return } NSScreen.preferred.repositionPanel(self) } + // prevent further AppKit work + thumbnailsView.clearNeedsLayout() } override func orderOut(_ sender: Any?) { + thumbnailsView.clearNeedsLayout() if Preferences.fadeOutAnimation { NSAnimationContext.runAnimationGroup( { _ in animator().alphaValue = 0 }, diff --git a/src/ui/main-window/ThumbnailsView.swift b/src/ui/main-window/ThumbnailsView.swift index 57a800b4..4b90722e 100644 --- a/src/ui/main-window/ThumbnailsView.swift +++ b/src/ui/main-window/ThumbnailsView.swift @@ -261,6 +261,15 @@ class ThumbnailsView { } } + func clearNeedsLayout() { + let views = [contentView, scrollView, scrollView.contentView, scrollView.documentView].compactMap { $0 } + for view in views { + view.needsLayout = false + view.needsDisplay = false + view.needsUpdateConstraints = false + } + } + struct LayoutCache { var labelHeight = CGFloat(0) var iconWidth = CGFloat(0)