perf: prevent appkit work

This commit is contained in:
lwouis committed 2026-02-11 21:35:29 +01:00
1 parent 41e0e7c688
commit fefc491ce5
2 files changed
+12

No files matched your search

+3
View File
@@ -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 },
+9
View File
@@ -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)