diff options
| author | Fuwn <[email protected]> | 2025-03-02 07:59:54 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-03-02 07:59:54 -0800 |
| commit | 08d9b4f6f8c5c903203877bd940311cde052bd21 (patch) | |
| tree | 0041fa05ac131937ed7901558f187c845430d4f9 /Sora | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-08d9b4f6f8c5c903203877bd940311cde052bd21.tar.xz sora-testing-08d9b4f6f8c5c903203877bd940311cde052bd21.zip | |
feat: Development commit
Diffstat (limited to 'Sora')
| -rw-r--r-- | Sora/Views/Post/Details/PostDetailsCarouselView.swift | 3 | ||||
| -rw-r--r-- | Sora/Views/Settings/Section/SettingsDetailsView.swift | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Sora/Views/Post/Details/PostDetailsCarouselView.swift b/Sora/Views/Post/Details/PostDetailsCarouselView.swift index 1d6acb0..6b4ba02 100644 --- a/Sora/Views/Post/Details/PostDetailsCarouselView.swift +++ b/Sora/Views/Post/Details/PostDetailsCarouselView.swift @@ -75,6 +75,9 @@ struct PostDetailsCarouselView: View { private func preloadNearbyImages() { let preloadRange = settings.preloadedCarouselImages + + guard preloadRange > 0 else { return } + let startIndex = max(0, currentIndex - preloadRange) let endIndex = min(posts.count - 1, currentIndex + preloadRange) var urlsToPreload: [URL] = [] diff --git a/Sora/Views/Settings/Section/SettingsDetailsView.swift b/Sora/Views/Settings/Section/SettingsDetailsView.swift index 885ef6f..3866994 100644 --- a/Sora/Views/Settings/Section/SettingsDetailsView.swift +++ b/Sora/Views/Settings/Section/SettingsDetailsView.swift @@ -22,15 +22,17 @@ struct SettingsDetailsView: View { } #endif + let preloadRange = 0...10 + #if os(macOS) Picker("Preloaded Images", selection: $settings.preloadedCarouselImages) { - ForEach(1...10, id: \.self) { columns in Text("\(columns)") } + ForEach(preloadRange, id: \.self) { columns in Text("\(columns)") } } #else Stepper( "Preloaded Images: \(settings.preloadedCarouselImages)", value: $settings.preloadedCarouselImages, - in: 1...10 + in: preloadRange ) #endif } |