mirror of
https://github.com/yattee/yattee.git
synced 2025-11-22 14:41:19 +00:00
Fix thumbnail aspect ratio in video grid cells
Thumbnails were being stretched vertically due to incorrect aspect ratio handling. Fixed by: - Using .scaledToFill() on thumbnails to fill the container width - Constraining container to 16:9 aspect ratio with .fit mode - Adding matching aspect ratio to placeholder to prevent layout shift during loading This ensures thumbnails maintain proper proportions while filling the full cell width.
This commit is contained in:
@@ -44,13 +44,13 @@ struct ThumbnailView: View {
|
||||
|
||||
var webImage: some View {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.onFailure { _ in
|
||||
if let url {
|
||||
thumbnails.insertUnloadable(url)
|
||||
}
|
||||
}
|
||||
.placeholder { placeholder }
|
||||
.resizable()
|
||||
}
|
||||
|
||||
@ViewBuilder var asyncImageIfAvailable: some View {
|
||||
@@ -76,6 +76,8 @@ struct ThumbnailView: View {
|
||||
}
|
||||
|
||||
var placeholder: some View {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
Rectangle()
|
||||
.fill(Color("PlaceholderColor"))
|
||||
.aspectRatio(Constants.aspectRatio16x9, contentMode: .fit)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user