From e25dcd21464287cad6fc8b01c4da8a5c4c0e0b70 Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Tue, 26 May 2020 01:59:52 +0900 Subject: [PATCH] fix: center-aligned layout was sometimes broken (closes #352) --- src/ui/main-window/ThumbnailsView.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ui/main-window/ThumbnailsView.swift b/src/ui/main-window/ThumbnailsView.swift index 2b70729f..705d7a58 100644 --- a/src/ui/main-window/ThumbnailsView.swift +++ b/src/ui/main-window/ThumbnailsView.swift @@ -59,7 +59,6 @@ class ThumbnailsView: NSVisualEffectView { var currentY = Preferences.interCellPadding var maxX = CGFloat(0) var maxY = currentY + height + Preferences.interCellPadding - var test = CGFloat(0) scrollView.documentView!.subviews.removeAll() rows.removeAll() rows.append([ThumbnailView]()) @@ -77,12 +76,10 @@ class ThumbnailsView: NSVisualEffectView { currentX = projectedWidth(currentX, width).rounded(.down) maxY = max(currentY + height + Preferences.interCellPadding, maxY) rows.append([ThumbnailView]()) - test = 0 } else { view.frame.origin = CGPoint(x: localizedCurrentX(currentX, width), y: currentY) currentX = projectedX maxX = max(isLeftToRight ? currentX : widthMax - currentX, maxX) - test += width } scrollView.documentView!.subviews.append(view) rows[rows.count - 1].append(view) @@ -126,7 +123,9 @@ class ThumbnailsView: NSVisualEffectView { var rowStartIndex = 0 var rowWidth = Preferences.interCellPadding var rowY = Preferences.interCellPadding - for (index, _) in Windows.list.enumerated() { + for (index, window) in Windows.list.enumerated() { + guard App.app.appIsBeingUsed else { return } + guard window.shouldShowTheUser else { continue } let view = ThumbnailsView.recycledViews[index] if view.frame.origin.y == rowY { rowWidth += view.frame.size.width + Preferences.interCellPadding