Allow a little bit of variance from square for compact layout

This commit is contained in:
Jed Fox 2022-12-02 15:54:02 -05:00
parent 61a07e9a5b
commit 52f5213990
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
1 changed files with 3 additions and 2 deletions

View File

@ -184,9 +184,10 @@ private extension StatusCardControl {
private extension Card {
var layout: StatusCardControl.Layout {
return width == height || image == nil
let aspectRatio = CGFloat(width) / CGFloat(height)
return abs(aspectRatio - 1) < 0.05 || image == nil
? .compact
: .large(aspectRatio: CGFloat(width) / CGFloat(height))
: .large(aspectRatio: aspectRatio)
}
}