diff --git a/README.md b/README.md index 2509492b..0c4a75c3 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ It does not import either service’s existing watched history or replace server ## Apple TV I’ve built the TV experience around a configurable Home spotlight, local Home metadata caching, a Library tab for your libraries and saved lists, and saved server accounts with optional profile PINs. -Search uses six posters across the available width, and a short press of the Siri button anywhere in the app searches by voice. +Search uses seven posters across the available width, and a short press of the Siri button anywhere in the app searches by voice. TV cards share consistent title and year captions. Detail pages include TMDb trailers and ratings, server-only More Like This, compact playback selections and a Start Over menu when you long-press Resume. The [Apple TV guide](docs/apple-tv-browsing.md) covers the current behaviour and validation status. diff --git a/docs/app-design.md b/docs/app-design.md index 2a339e2f..5ae40958 100644 --- a/docs/app-design.md +++ b/docs/app-design.md @@ -99,9 +99,10 @@ Under posters, titles use 24-point medium text and secondary captions use 22-poi Continue Watching, Next Up, the other landscape episode rows on Home and the Library tab's library cards use the same 24-point titles and 22-point secondary captions, on cards that keep their size. Episodes substitute episode details for the year and keep them with Title Only, because their title is the series name. Only Artwork Only hides an episode's season and episode line, and rows holding an episode keep room for that line. -Search keeps six columns across the safe-area width with reduced spacing below its result tabs. -Every Apple TV poster grid (Search and its Seerr results, the Library tab, library pages, collection and Studios & Networks pages, the Collections tab and Calendar's day view) shows six posters across, each 260 by 390 points. -Home's poster rows and the rails that match them (the Collections row, More Like This, collection rails, Studios & Networks rails and Cast & Crew) show posters 240 by 360 points, and a person's filmography shows seven posters across at the Standard poster size, or six at Compact or Large. +Search keeps seven columns across the safe-area width with reduced spacing below its result tabs. +Every Apple TV poster grid (Search and its Seerr results, the Library tab, library pages, collection and Studios & Networks pages, the Collections tab and Calendar's day view) shows seven posters across, each about 217 by 326 points. +Home's poster rows and the rails that match them (the Collections row, More Like This, collection rails, Studios & Networks rails and Calendar's Trending rails) show posters 220 by 330 points, and a person's filmography shows seven posters across like the other grids. +Cast & Crew photos are 180 by 270 points. Detail pages keep their credit, playback-readout and action rows at fixed baselines through loading and episode changes. Long-pressing Play or Resume opens a native context menu: Start Over when there's something to resume, and Shuffle on a series page. @@ -511,7 +512,7 @@ This does not establish complete converted-download or offline-playback coverage Series details expose Episode, Season and Series watched actions in that order. iOS uses the Watched menu; tvOS places them in the three-dot More menu. -Cast and crew pages use Home-sized filmography posters (three columns on iPhone and compact iPad) and the shared, left-aligned title/year caption settings. +Cast and crew pages use Home-sized filmography posters on iPhone and iPad (three columns on iPhone and compact iPad), the seven-across grid on Apple TV, and the shared, left-aligned title/year caption settings. Cached person metadata appears on reopening while fresh metadata and filmography load concurrently. On iOS, iPadOS and tvOS, the shared person formatter displays Emby birth/death timestamps as calendar dates, including timestamps with seven fractional digits. It preserves the source day, validates date and time/offset ranges and hides malformed values instead of showing raw numbers. @@ -524,7 +525,7 @@ Movie and series pages also show the TMDb user score after the quality badges on It needs a signed-in account and profile, lists only titles in the library in release order, includes the current movie, and is hidden when the movie has no collection or is the only one from it in the library. Titles are matched against the library list Studios & Networks saves each day, so the row never searches the server, stays hidden until that list exists and picks up newly added films after the next daily refresh. Selecting the current movie's card keeps the page in place. -Cast & Crew uses portrait posters at the same size as More Like This: the shared card size on iPhone and iPad, and Home's Large poster size on Apple TV. +Cast & Crew uses portrait posters at the same size as More Like This on iPhone and iPad, and 180 by 270 point photos on Apple TV. Directors come first, then writers and creators (anyone already shown as director is left out), then the cast in the server's billing order, each later group after a thin divider with a rotated WRITERS or CAST label. Emby connections do not read crew, so Emby titles show only the cast. Tapping an actor’s biography on iOS opens the full text in a scrollable sheet with a Done button. @@ -611,7 +612,7 @@ The exception is detail pages: `PhoneDuo.usesDuoDetailDesign` and the `onDuoDeta With just the time and connectivity icons it ends 170 points down on the cover, 120 in the inner screen's landscape strip and 82 in its portrait corner, and the layouts above are placed for that. When widgets make it longer, the X and back buttons and the Settings avatar bar move down by the same amount, and so does the top of the tab bar, which gets shorter so its bottom stays put. Builds without the iOS 27.1 SDK keep the usual positions. -- **Grids:** Library-page, Search, Watchlist, Favourites and collection grids fit posters to the inner screen like Apple TV: six across in landscape and four in portrait. +- **Grids:** Library-page, Search, Watchlist, Favourites and collection grids fit posters to the inner screen: six across in landscape and four in portrait. The cover keeps three. - **Detail pages:** the inner screen keeps the iPhone portrait design in both orientations, with its parallax and artwork glass, and no glass bar or title fading in while scrolling. Play shares a row with Favourite, Watchlist, Watched, Shuffle and Download (Shuffle on series only), whose circles match Play's height with even gaps; the row, synopsis, credits and playback selectors sit in one 560-point column centred under the logo, and the season chips are centred. diff --git a/docs/apple-tv-browsing.md b/docs/apple-tv-browsing.md index a07bf099..c1207fa8 100644 --- a/docs/apple-tv-browsing.md +++ b/docs/apple-tv-browsing.md @@ -305,7 +305,8 @@ Completed bytes use the existing HTTP cache, and retry budgets, download limits Home uses a vertical `VStack` of reserved-height `VividCollectionMediaRow` rails backed by CollectionHStack, with the full metadata cache, expanded artwork cache and nearby-row warming. Row dimensions follow Home Sections visibility and the caption setting; Home posters are always Large. -A Home poster is 240 by 360 points, and a landscape card (Continue Watching, Next Up and episode rows) is 432 by 240 points. +A Home poster is 220 by 330 points, and a landscape card (Continue Watching, Next Up, episode rows and library cards) is 400 by 222 points. +The episode rail on season pages and the older movie layout uses 400 by 225 point stills, the size of the series page's episode shelf. The six-enabled-rail limit excludes Spotlight; empty enabled rows reserve a slot. Row focus updates are isolated from the feed. The owner accepted the cleanup and native card effects on Apple TV. @@ -358,7 +359,7 @@ The four are a random pick from the library's 40 most recently added titles, mad A request that fails is made again the next time the card appears; one that succeeds is not repeated, even when it found no posters. Until the posters arrive, and when none of those 40 titles has one, the card shows the library's symbol on a plain tile. Below the row are the Watchlist, Favourites and Collections sub-tabs the For You tab used to hold. -Selecting a library pushes a page with the library's name, the same native Sort, Filter and A–Z menus and the poster grid the Movies and Series pages had, now six columns across, without the old category dropdowns or mixed Recommended/Browse landing page. +Selecting a library pushes a page with the library's name, the same native Sort, Filter and A–Z menus and the poster grid the Movies and Series pages had, now seven columns across, without the old category dropdowns or mixed Recommended/Browse landing page. A mixed library such as Sports is one card, and its page shows movies and series together; it used to appear under both Movies and Series, filtered by type. Movie and series libraries still ask the server for their own type; classification depends on the server's metadata. A mixed library asks for every type, and its Filter menu adds a Type choice to narrow it to movies or series. @@ -409,17 +410,17 @@ The library list is the account's, so it can include libraries the profile hides A library that fails to load leaves the others on screen, and the page only shows an error when nothing loads. Posters load for the rows around the cards on screen; a card the lazy grid drops counts as off screen, so the window follows the scroll instead of staying on rows already passed. When no card counts as on screen, as after returning from a collection, the window follows the remembered focus. -Catalogue grids use six posters across, each 260 by 390 points, with deliberate space above the first row for focus enlargement. +Catalogue grids use seven posters across, each about 217 by 326 points, with deliberate space above the first row for focus enlargement. Calendar is laid out like Library's lists, with Upcoming and Trending sub-tabs and a Calendar pill on the right where Library keeps Filter and A–Z. Upcoming shows the same episodes as on iPhone and iPad (see [App Design](app-design.md)), as cards grouped by day, three across; choosing one opens the series. Trending shows rails of series and movies coming soon with local date badges, and choosing a poster shows its date and overview. -Its posters are 240 by 360 points in the rails and six across in a day's releases, with the same 24-point titles and 22-point second lines as other posters. +Its posters are 220 by 330 points in the rails and seven across in a day's releases, with the same 24-point titles and 22-point second lines as other posters. The Calendar pill opens a month view of the page's window: on Upcoming, choosing a day with a dot scrolls to it; on Trending, it shows that day's releases with Show all to go back. -Search uses six posters across the available safe-area width, without the previous extra horizontal insets or width cap. +Search uses seven posters across the available safe-area width, without the previous extra horizontal insets or width cap. Below the grid, other saved profiles with matches each get a row headed by their picture, name and server nickname (see [Other saved profiles](server-connections.md#other-saved-profiles)). -Seerr's Available to request results use the same six columns. +Seerr's Available to request results use the same seven columns. The results sit closer to the Top Results, Movies and Series tabs. ### Siri search @@ -452,8 +453,9 @@ It keeps a small look-behind and releases earlier decoded image references as sc Visible and upcoming posters are warmed before the look-behind, with two requests at a time; queue updates can refill evicted images. Visible or focused catalogue cards always remain eligible to load, and distant cards release their image through the same image view without replacing its subtree. Lightweight item metadata remains available for navigation; this is not a fixed total app-memory limit. -Six-column catalogue grids request the next page with four rows remaining and recheck when a row becomes visible or a page arrives. -A page of seventy doesn't fill a whole number of six-poster rows, so the last row can be part filled until the next page arrives and completes it. +Seven-column catalogue grids request the next page with four rows remaining and recheck when a row becomes visible or a page arrives. +A library page of seventy fills exactly ten seven-poster rows, so its last row is only part filled when a page comes back short, such as the last one. +Search, collection pages and a person's filmography page by sixty, which isn't a whole number of seven-poster rows, so their last row is usually part filled while more pages load; each new page fills that row and can leave a new part-filled one. The grids keep posters decoded for eight rows around the screen, two of them behind the first visible row. Native card controls, focus styling and layout are unchanged. The owner confirmed that the installed scrolling follow-up resolved the Movies and Series focus/artwork issue. @@ -768,8 +770,8 @@ The changed shared code also needs iOS validation; the current tvOS build does n Read [focus ownership rules](apple-tv-focus.md) before changing navigation. Preserve series season/episode focus, context-menu restoration, and cancellation of obsolete artwork work. -Cast and crew filmography uses Home’s dense poster width and shared title/year captions. -The portrait at the top of a person's page uses the same dense width, 200 by 300 points. +Cast and crew filmography uses the same seven-across grid as the other catalogue grids, with shared title/year captions. +The portrait at the top of a person's page is 200 by 300 points. Watchlist and Favourites no longer show Movie or Series pills on iOS or tvOS; the Filter menu's Show choice separates them instead. Library’s secondary tabs scroll with Watchlist, Favourites and Collections. Person details reuse the active profile’s response cache while refreshing in the background; filmography and filter availability load alongside the person request. diff --git a/iosApp/iosApp/Components/Cards/LandscapeEpisodeCard.swift b/iosApp/iosApp/Components/Cards/LandscapeEpisodeCard.swift index faa0bf78..26df0fda 100644 --- a/iosApp/iosApp/Components/Cards/LandscapeEpisodeCard.swift +++ b/iosApp/iosApp/Components/Cards/LandscapeEpisodeCard.swift @@ -63,8 +63,10 @@ struct EpisodeThumbCard: View { private var cardSize: CGSize { let presentation = homeCardPresentation ?? UICustomizationPreferences.shared.cardPresentation - let width = VividTheme.thumbnailCardWidth * presentation.posterSize.scale - return CGSize(width: width, height: width * VividTheme.thumbnailCardHeight / VividTheme.thumbnailCardWidth) + // Rounded so the 400 by 222 point card doesn't pick up a stray + // fraction from the token's division by the Large scale. + let width = (VividTheme.thumbnailCardWidth * presentation.posterSize.scale).rounded() + return CGSize(width: width, height: (width * VividTheme.thumbnailCardHeight / VividTheme.thumbnailCardWidth).rounded()) } private var caption: CardCaptionStyle { TVHomeCardPreferences.shared.presentation.caption } diff --git a/iosApp/iosApp/DesignSystem/Layout/TVHomeRows.swift b/iosApp/iosApp/DesignSystem/Layout/TVHomeRows.swift index 10b60b05..eda1b0b0 100644 --- a/iosApp/iosApp/DesignSystem/Layout/TVHomeRows.swift +++ b/iosApp/iosApp/DesignSystem/Layout/TVHomeRows.swift @@ -62,10 +62,10 @@ enum TVHomeRowGeometry { let captionGap: CGFloat switch layout { case .poster: - artworkHeight = posterWidth * scale * VividTheme.posterCardHeight / VividTheme.posterCardWidth + artworkHeight = (posterWidth * scale * VividTheme.posterCardHeight / VividTheme.posterCardWidth).rounded() captionGap = posterCaptionGap case .thumbnail: - artworkHeight = VividTheme.thumbnailCardHeight * scale + artworkHeight = (VividTheme.thumbnailCardHeight * scale).rounded() captionGap = thumbnailCaptionGap } var height = artworkHeight diff --git a/iosApp/iosApp/DesignSystem/Tokens/VividLayoutTokens.swift b/iosApp/iosApp/DesignSystem/Tokens/VividLayoutTokens.swift index fcbad196..ea0d07ff 100644 --- a/iosApp/iosApp/DesignSystem/Tokens/VividLayoutTokens.swift +++ b/iosApp/iosApp/DesignSystem/Tokens/VividLayoutTokens.swift @@ -17,8 +17,11 @@ enum VividTheme { static let posterCardWidth: CGFloat = 260 static let posterCardHeight: CGFloat = 390 - static let thumbnailCardWidth: CGFloat = 360 - static let thumbnailCardHeight: CGFloat = 200 + /// A landscape card (Continue Watching, Next Up, episode rows and + /// library cards) before Home's Large scale, which Home always uses: + /// 400 by 222 points on screen. + static let thumbnailCardWidth: CGFloat = 400 / CardPosterSize.large.scale + static let thumbnailCardHeight: CGFloat = 222 / CardPosterSize.large.scale #else static let cornerRadius: CGFloat = 8 static let smallCornerRadius: CGFloat = 6 @@ -55,17 +58,21 @@ extension VividTheme { static let barTopInset: CGFloat = 0 static let barHeight: CGFloat = 64 static let tabSpacing: CGFloat = 8 + /// A poster in Home's rows and the rails that match them, on screen. + static let railPosterWidth: CGFloat = 220 /// The poster width of Home rows and the rails that match them, - /// before Home's Large scale: 240 by 360 points on screen. - static let densePosterCardWidth: CGFloat = 200 + /// before Home's Large scale: 220 by 330 points on screen. + static let densePosterCardWidth: CGFloat = railPosterWidth / CardPosterSize.large.scale + /// A Cast & Crew photo on detail pages: 180 by 270 points. + static let castPhotoWidth: CGFloat = 180 /// Posters across a catalogue grid: Search, library pages, collection - /// and studio pages. Six across the 1,760-point safe width makes each - /// poster 260 by 390 points. - static let posterGridColumns = 6 + /// and studio pages. Seven across the 1,760-point safe width makes + /// each poster about 217 by 326 points. + static let posterGridColumns = 7 /// The rows of a catalogue grid kept decoded around the screen. Eight - /// rows of six-across posters hold no more decoded pixels than ten - /// rows of the earlier seven-across ones, so the band stays inside - /// the decoded budget on Apple TVs with less memory. + /// rows of seven-across posters hold fewer decoded pixels than the + /// earlier eight rows of six-across 260-point ones, so the band stays + /// inside the decoded budget on Apple TVs with less memory. static let posterGridArtworkRows = 8 /// The gap between a poster and its caption on Home's rows, which /// leaves room for the focus lift of a poster this size. diff --git a/iosApp/iosApp/Screens/People/PersonPage.swift b/iosApp/iosApp/Screens/People/PersonPage.swift index aec8b14b..9d5a31c8 100644 --- a/iosApp/iosApp/Screens/People/PersonPage.swift +++ b/iosApp/iosApp/Screens/People/PersonPage.swift @@ -208,9 +208,12 @@ struct PersonDetailView: View { } } + /// The header portrait keeps its own size; it isn't a card. + private static let tvPortraitWidth: CGFloat = 200 + private func header(_ person: Person) -> some View { HStack(alignment: .top, spacing: 48) { - PersonPortrait(person: person, width: VividTheme.Skyline.densePosterCardWidth) + PersonPortrait(person: person, width: Self.tvPortraitWidth) VStack(alignment: .leading, spacing: 22) { Text(person.name) .font(.system(size: 64, weight: .bold)) @@ -271,8 +274,7 @@ struct PersonDetailView: View { hasMore: model.hasMore, onItemTap: open, onNearEnd: { index in Task { await model.nearEnd(at: index) } }, - columnCount: 7, - cardWidth: VividTheme.Skyline.densePosterCardWidth + fixedColumnCount: VividTheme.Skyline.posterGridColumns ) } } diff --git a/iosApp/iosApp/Screens/Requests/RequestResultCard.swift b/iosApp/iosApp/Screens/Requests/RequestResultCard.swift index 12d39f85..f2bb6441 100644 --- a/iosApp/iosApp/Screens/Requests/RequestResultCard.swift +++ b/iosApp/iosApp/Screens/Requests/RequestResultCard.swift @@ -10,12 +10,16 @@ struct RequestStatusRibbon: View { private let fontSize: CGFloat = 20 private let horizontalPadding: CGFloat = 16 private let verticalPadding: CGFloat = 8 + /// Longer labels shrink a little to fit a seven-across poster instead + /// of cutting off. + private let minimumScale: CGFloat = 0.8 #else private let spacing: CGFloat = 5 private let dotSize: CGFloat = 6 private let fontSize: CGFloat = 10 private let horizontalPadding: CGFloat = 8 private let verticalPadding: CGFloat = 4 + private let minimumScale: CGFloat = 1 #endif var body: some View { @@ -27,6 +31,7 @@ struct RequestStatusRibbon: View { .font(.system(size: fontSize, weight: .bold)) .foregroundStyle(.white) .lineLimit(1) + .minimumScaleFactor(minimumScale) } .padding(.horizontal, horizontalPadding) .padding(.vertical, verticalPadding) diff --git a/iosApp/iosApp/tvOS/Components/TVHomeDiscoveryFeed.swift b/iosApp/iosApp/tvOS/Components/TVHomeDiscoveryFeed.swift index 671b10a1..f0dc4ff0 100644 --- a/iosApp/iosApp/tvOS/Components/TVHomeDiscoveryFeed.swift +++ b/iosApp/iosApp/tvOS/Components/TVHomeDiscoveryFeed.swift @@ -789,8 +789,8 @@ private struct TVHomeArtworkWarmupModifier: ViewModifier { let ratio = wide ? VividTheme.thumbnailCardHeight / VividTheme.thumbnailCardWidth : VividTheme.posterCardHeight / VividTheme.posterCardWidth // Use the same arithmetic as the card before rounding to pixel keys. - let width = baseWidth * presentation.posterSize.scale - let height = width * ratio + let width = (baseWidth * presentation.posterSize.scale).rounded() + let height = (width * ratio).rounded() let size = CGSize(width: width * PosterImageCache.displayScale, height: height * PosterImageCache.displayScale) let visibleCount = max(1, Int(ceil((viewportWidth + 40) / (width + 40)))) diff --git a/iosApp/iosApp/tvOS/Components/TVStudiosNetworks.swift b/iosApp/iosApp/tvOS/Components/TVStudiosNetworks.swift index a9456328..8f1f4cab 100644 --- a/iosApp/iosApp/tvOS/Components/TVStudiosNetworks.swift +++ b/iosApp/iosApp/tvOS/Components/TVStudiosNetworks.swift @@ -274,8 +274,8 @@ private struct TVStudioNetworkPageContent: View, Equatable { } } - /// Laid out like a TVCatalogGrid row: six equal columns across the - /// inset width, cards sized to fill them. + /// Laid out like a TVCatalogGrid row: `posterGridColumns` equal columns + /// across the inset width, cards sized to fill them. private func firstGridRow(_ items: [BrowseItem]) -> some View { let width = (1920 - Self.inset * 2 - Self.columnSpacing * CGFloat(Self.columns - 1)) / CGFloat(Self.columns) / gridPosterSize.scale diff --git a/iosApp/iosApp/tvOS/Screens/Calendar/TVCalendarView.swift b/iosApp/iosApp/tvOS/Screens/Calendar/TVCalendarView.swift index 4f3b8d18..f570a2ae 100644 --- a/iosApp/iosApp/tvOS/Screens/Calendar/TVCalendarView.swift +++ b/iosApp/iosApp/tvOS/Screens/Calendar/TVCalendarView.swift @@ -237,7 +237,7 @@ struct TVCalendarView: View { LazyHStack(alignment: .top, spacing: 40) { ForEach(titles) { title in TVTrendingPoster(title: title) { selectedTitle = title } - .frame(width: 240) + .frame(width: VividTheme.Skyline.railPosterWidth) } } .padding(.vertical, 24) @@ -370,7 +370,7 @@ private struct TVTrendingPoster: View { ZStack(alignment: .topLeading) { Color.vividSurfaceVariant if let url = title.posterURL { - AsyncImageView(url: url.absoluteString, targetSize: CGSize(width: 260, height: 390), contentMode: .fill) + AsyncImageView(url: url.absoluteString, targetSize: CGSize(width: VividTheme.Skyline.railPosterWidth, height: VividTheme.Skyline.railPosterWidth * 1.5), contentMode: .fill) } Text(title.day.formatted(.dateTime.day().month(.abbreviated)).uppercased()) .font(.system(size: 18, weight: .bold)) diff --git a/iosApp/iosApp/tvOS/Screens/Detail/TVDetailPageShells.swift b/iosApp/iosApp/tvOS/Screens/Detail/TVDetailPageShells.swift index dbf05235..38ddb2a6 100644 --- a/iosApp/iosApp/tvOS/Screens/Detail/TVDetailPageShells.swift +++ b/iosApp/iosApp/tvOS/Screens/Detail/TVDetailPageShells.swift @@ -115,10 +115,8 @@ struct TVDetailStandardSurface: View { /// Darkens the older layout below its first shelf, so the rails sit on /// black while the hero keeps its tint. struct TVDetailLowerBackground: View { - @State private var preferences = UICustomizationPreferences.shared - var body: some View { - let cardHeight = VividTheme.thumbnailCardHeight * preferences.cardPresentation.posterSize.scale + let cardHeight = TVEpisodeRail.defaultCardHeight VStack(spacing: 0) { Color.clear .frame(height: 52 + 8 + 14 + 12 + cardHeight / 2) diff --git a/iosApp/iosApp/tvOS/Screens/Detail/TVDetailRails.swift b/iosApp/iosApp/tvOS/Screens/Detail/TVDetailRails.swift index 848d16ed..557d3023 100644 --- a/iosApp/iosApp/tvOS/Screens/Detail/TVDetailRails.swift +++ b/iosApp/iosApp/tvOS/Screens/Detail/TVDetailRails.swift @@ -41,12 +41,11 @@ struct TVCastAndCrewRail: View { let crew: [CrewMember] let onSelectPerson: (String) -> Void - @State private var homeCards = TVHomeCardPreferences.shared @FocusState private var focusedKey: String? var body: some View { let groups = CastCrewGrouping.groups(cast: cast, crew: crew, maxCast: 24, maxCrewPerGroup: 6) - let photoWidth = VividTheme.Skyline.densePosterCardWidth * homeCards.presentation.posterSize.scale + let photoWidth = VividTheme.Skyline.castPhotoWidth let photoSize = CGSize(width: photoWidth, height: photoWidth * 1.5) let firstKey = groups.first.flatMap { group in group.people.first.map { Self.key(group, $0) } } ScrollView(.horizontal) { @@ -124,7 +123,9 @@ private struct TVCastPersonCard: View { } var body: some View { - VStack(spacing: 12) { + // The same gap as Home's posters, so the focus lift doesn't cover + // the name. + VStack(spacing: VividTheme.Skyline.posterCaptionGap) { Button(action: action) { photo } diff --git a/iosApp/iosApp/tvOS/Screens/Detail/TVEpisodeRail.swift b/iosApp/iosApp/tvOS/Screens/Detail/TVEpisodeRail.swift index 4ea436d9..cc110b0c 100644 --- a/iosApp/iosApp/tvOS/Screens/Detail/TVEpisodeRail.swift +++ b/iosApp/iosApp/tvOS/Screens/Detail/TVEpisodeRail.swift @@ -15,10 +15,15 @@ struct TVEpisodeRail: View { private let currentContentIsFavorite: Bool private let favoriteStates: [String: Bool] private let prefersCurrentContentFocus: Bool - private let baseCardWidth: CGFloat + private let cardWidth: CGFloat private let cardSpacing: CGFloat private let anchorsFocusedCard: Bool + /// Episode stills are 400 by 225 points, the size of the series page's + /// episode shelf. + static let defaultCardWidth: CGFloat = 400 + static let defaultCardHeight: CGFloat = defaultCardWidth * 9 / 16 + @State private var preferences = UICustomizationPreferences.shared @FocusState private var focusedId: String? @@ -34,7 +39,7 @@ struct TVEpisodeRail: View { currentContentIsFavorite: Bool = false, favoriteStates: [String: Bool] = [:], prefersCurrentContentFocus: Bool = false, - baseCardWidth: CGFloat = 480, + cardWidth: CGFloat = TVEpisodeRail.defaultCardWidth, cardSpacing: CGFloat = 54, anchorsFocusedCard: Bool = false ) { @@ -49,7 +54,7 @@ struct TVEpisodeRail: View { self.currentContentIsFavorite = currentContentIsFavorite self.favoriteStates = favoriteStates self.prefersCurrentContentFocus = prefersCurrentContentFocus - self.baseCardWidth = baseCardWidth + self.cardWidth = cardWidth self.cardSpacing = cardSpacing self.anchorsFocusedCard = anchorsFocusedCard } @@ -66,7 +71,6 @@ struct TVEpisodeRail: View { var body: some View { let presentation = preferences.cardPresentation - let cardWidth = baseCardWidth * presentation.posterSize.scale ScrollViewReader { proxy in ScrollView(.horizontal) { LazyHStack(alignment: .top, spacing: cardSpacing) { diff --git a/iosApp/iosApp/tvOS/Screens/Libraries/TVLibraryCardRow.swift b/iosApp/iosApp/tvOS/Screens/Libraries/TVLibraryCardRow.swift index 69237872..9042c78a 100644 --- a/iosApp/iosApp/tvOS/Screens/Libraries/TVLibraryCardRow.swift +++ b/iosApp/iosApp/tvOS/Screens/Libraries/TVLibraryCardRow.swift @@ -27,8 +27,8 @@ extension TVMainTabView { @State private var homeCards = TVHomeCardPreferences.shared private var cardSize: CGSize { - let width = VividTheme.thumbnailCardWidth * homeCards.presentation.posterSize.scale - return CGSize(width: width, height: width * VividTheme.thumbnailCardHeight / VividTheme.thumbnailCardWidth) + let width = (VividTheme.thumbnailCardWidth * homeCards.presentation.posterSize.scale).rounded() + return CGSize(width: width, height: (width * VividTheme.thumbnailCardHeight / VividTheme.thumbnailCardWidth).rounded()) } var body: some View {