Cotton code
38 lines · 1.6 KB · SwiftRaw
// A FAN VIEW AMONG THE INK'S RESULTS (owner, 11 Nov 2026: "the first-tier// menu can also be part of the results"): letters that start a view's or a// list's name keep its tile, which stands in the deck as the fan draws it —// the fan tile's own look (`FanTierCard`), never a face of its own — at the// card's width, centred where the card stands. A tap on it opens the view// (`DeckSurface.openView`); it is held by nothing.import CottonKitimport SwiftUIstruct DeckViewTile: View {    let tool: String    let view: ToolView    /// The tool's fan tile, which the fan's views tier is drawn as.    let tile: FanTileLook?    @Environment(\.theme) private var theme    var body: some View {        GeometryReader { box in            #if os(iOS)            let card = ViewTier.make(tool: tool, views: [view], current: nil, tile: tile).cards[0]            let metrics = ToolCardMetrics(scale: theme.scale)            let width = min(box.size.width * DeckViewTileKnobs.width, box.size.height * metrics.aspect * DeckViewTileKnobs.width)            FanTierCard(look: FanTierArc.Look(card: card, raised: true, width: width, height: width / metrics.aspect, tile: tile))                .frame(width: box.size.width, height: box.size.height)            #endif        }        .accessibilityElement(children: .ignore)        .accessibilityLabel(ViewTier.spoken(view))        .accessibilityAddTraits(.isButton)        .accessibilityIdentifier("deck-view-\(tool)-\(view.id)")    }}enum DeckViewTileKnobs {    /// The tile's width, of the card's.    static let width: CGFloat = 0.62}