mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 00:22:12 +00:00
added setting to change anime per row in landscape and portrait modes + fixed stretched images 2
This commit is contained in:
parent
bbebf14837
commit
6d6bc33dfe
3 changed files with 18 additions and 7 deletions
|
|
@ -76,6 +76,10 @@ struct LibraryView: View {
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
} else {
|
} else {
|
||||||
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 12), count: columnsCount), spacing: 12) {
|
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 12), count: columnsCount), spacing: 12) {
|
||||||
|
let totalSpacing: CGFloat = 16 * CGFloat(columnsCount + 1) // Spacing between items
|
||||||
|
let availableWidth = UIScreen.main.bounds.width - totalSpacing
|
||||||
|
let cellWidth = availableWidth / CGFloat(columnsCount)
|
||||||
|
|
||||||
ForEach(libraryManager.bookmarks) { item in
|
ForEach(libraryManager.bookmarks) { item in
|
||||||
if let module = moduleManager.modules.first(where: { $0.id.uuidString == item.moduleId }) {
|
if let module = moduleManager.modules.first(where: { $0.id.uuidString == item.moduleId }) {
|
||||||
NavigationLink(destination: MediaInfoView(title: item.title, imageUrl: item.imageUrl, href: item.href, module: module)) {
|
NavigationLink(destination: MediaInfoView(title: item.title, imageUrl: item.imageUrl, href: item.href, module: module)) {
|
||||||
|
|
@ -89,9 +93,9 @@ struct LibraryView: View {
|
||||||
.shimmering()
|
.shimmering()
|
||||||
}
|
}
|
||||||
.resizable()
|
.resizable()
|
||||||
.aspectRatio(2/3, contentMode: .fill)
|
.aspectRatio(contentMode: .fill)
|
||||||
// Allow the image to expand to fill the available width of its grid cell.
|
.frame(height: cellWidth * 3 / 2)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: cellWidth)
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.clipped()
|
.clipped()
|
||||||
.overlay(
|
.overlay(
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,10 @@ struct MediaInfoView: View {
|
||||||
.shimmering()
|
.shimmering()
|
||||||
}
|
}
|
||||||
.resizable()
|
.resizable()
|
||||||
.aspectRatio(2/3, contentMode: .fit)
|
.aspectRatio(contentMode: .fill)
|
||||||
.cornerRadius(10)
|
|
||||||
.frame(width: 150, height: 225)
|
.frame(width: 150, height: 225)
|
||||||
|
.clipped()
|
||||||
|
.cornerRadius(10)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text(title)
|
Text(title)
|
||||||
|
|
|
||||||
|
|
@ -112,15 +112,21 @@ struct SearchView: View {
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.padding(.top)
|
.padding(.top)
|
||||||
} else {
|
} else {
|
||||||
|
let totalSpacing: CGFloat = 16 * CGFloat(columnsCount + 1) // Spacing between items
|
||||||
|
let availableWidth = UIScreen.main.bounds.width - totalSpacing
|
||||||
|
let cellWidth = availableWidth / CGFloat(columnsCount)
|
||||||
|
|
||||||
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 16), count: columnsCount), spacing: 16) {
|
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 16), count: columnsCount), spacing: 16) {
|
||||||
ForEach(searchItems) { item in
|
ForEach(searchItems) { item in
|
||||||
NavigationLink(destination: MediaInfoView(title: item.title, imageUrl: item.imageUrl, href: item.href, module: selectedModule!)) {
|
NavigationLink(destination: MediaInfoView(title: item.title, imageUrl: item.imageUrl, href: item.href, module: selectedModule!)) {
|
||||||
VStack {
|
VStack {
|
||||||
KFImage(URL(string: item.imageUrl))
|
KFImage(URL(string: item.imageUrl))
|
||||||
.resizable()
|
.resizable()
|
||||||
.aspectRatio(2/3, contentMode: .fit)
|
.aspectRatio(contentMode: .fill)
|
||||||
|
.frame(height: cellWidth * 3 / 2)
|
||||||
|
.frame(maxWidth: cellWidth)
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.frame(maxWidth: .infinity)
|
.clipped()
|
||||||
Text(item.title)
|
Text(item.title)
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundColor(Color.primary)
|
.foregroundColor(Color.primary)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue