feat: better packing; tall thumbnails are 1/2 the width of wide ones

This commit is contained in:
louis.pontoise authored and lwouis committed 2020-03-10 14:00:37 +09:00
1 parent 0bc7472d17
commit e34e3b171f
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -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)>([
+1 -1
View File
@@ -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