Skip to content

Commit

Permalink
feat: better packing; tall thumbnails are 1/2 the width of wide ones
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent 0bc7472 commit e34e3b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion alt-tab-macos/logic/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Preferences {
static let fontIconSize = CGFloat(20)
static let maxScreenUsage = CGFloat(0.8)
static let minCellsPerRow = CGFloat(3)
static let maxCellsPerRow = CGFloat(4)
static let maxCellsPerRow = CGFloat(6)
static let nCellsRows = CGFloat(3)

static let themeMacro = MacroPreferenceHelper<(CGFloat, CGFloat, CGFloat, NSColor, NSColor)>([
Expand Down
2 changes: 1 addition & 1 deletion alt-tab-macos/ui/Cell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ class Cell: NSCollectionViewItem {
}

static func thumbnailSize(_ image: NSImage?, _ screen: NSScreen) -> (CGFloat, CGFloat) {
guard let image = image else { return (0, 0) }
let thumbnailHeightMax = Cell.height(screen) - Preferences.intraCellPadding * 3 - Preferences.iconSize
let thumbnailWidthMax = Cell.widthMax(screen) - Preferences.intraCellPadding * 2
guard let image = image else { return (Cell.widthMin(screen) - Preferences.intraCellPadding * 2, thumbnailHeightMax) }
let thumbnailHeight = min(image.size.height, thumbnailHeightMax)
let thumbnailWidth = min(image.size.width, thumbnailWidthMax)
let imageRatio = image.size.width / image.size.height
Expand Down

0 comments on commit e34e3b1

Please sign in to comment.