import { KYOGIJO_STRINGS } from "./strings.ts"; import { type TurnPreset, type TurnView } from "./turn.camera.ts"; import type { Plane } from "./turn.kit.ts"; import { type UprightOptions, type Uprights } from "./uprights.ts"; import type { VenueSettings } from "./venue.ts"; import type { Box3 } from "./turn.camera.ts"; import type { Language, ScoreOptions, SurfaceOptions } from "./types.ts"; /** What can be asked of a 3D view. */ export interface TurnSettings { /** The viewpoint it opens on: `overhead`, `broadcast`, `end` or `corner` (the default). */ preset?: TurnPreset; /** An exact opening view, laid over the preset's. */ view?: Partial; /** Whether the buttons under the view are drawn (a row of viewpoints, turn, raise, zoom and reset). True when left out; the keys and the pointer work either way. */ controls?: boolean; /** What stands on the surface: `false` for the floor alone, or which kinds, whether the boards and the glass are drawn, the height of a volleyball net. True when left out. */ uprights?: boolean | UprightOptions; /** * The venue round the surface, raised in 3D from the data the package already has: the stands of a drawing's `crowd` (every tier a strip of raked planes with the crowd on it, the walks between the tiers, a * ballpark's grandstands and the seats on top of its wall) and a dojo's room (its walls with their doors and windows, the dais, the banner, the balconies and the edge of the mats). `true` or `false`, or * `{ roof, detail }`. On when the drawing has a crowd or is a dojo, and off with `uprights: false`. The stands and the walls give way to the eye as the boards do, so that the surface is never hidden. */ venue?: boolean | VenueSettings; /** Where the score of a score drawing goes: `board` (the default) hangs it up as a scoreboard that faces the eye (over the middle of a court or a rink, behind an end of a field, behind centre field in a ballpark) and takes the panel off the floor; `floor` leaves the panel on the floor. */ score?: "board" | "floor"; /** What a finger does on the view: `scroll` (the default) lets a vertical swipe scroll the page and a sideways one turn the view; `turn` keeps every touch for the view, which then also tips it. */ touch?: "scroll" | "turn"; /** `smooth` glides between viewpoints, `none` jumps; `auto` (the default) glides unless the reader prefers reduced motion. */ motion?: "auto" | "smooth" | "none"; /** The drawing the floor is, in place of `drawKyogijo`: a chart's `draw`, for instance. It is given the options with the view's own changes (the whole surface, lying wide). */ floor?: (options: SurfaceOptions | ScoreOptions) => string; /** How long a lens the eye has, as a multiple of the view's longer side: 1.7 by default, and the larger it is the flatter the picture. */ lens?: number; /** The size the first view is worked out for, in pixels, when the markup is made away from a page. 960 by 600 by default. */ size?: { width: number; height: number; }; /** The prefix of the ids in the view, for a page with more than one. A hash of the options when missing. */ id?: string; /** * The auto-turn, a trophy case's slow turn of the whole view: `true` starts it when the view is mounted (paused, if the reader prefers reduced motion), `"force"` starts it even then; left out, nothing moves until * the reader presses Play (or Space). It stops while the pointer holds the view and while the page is hidden, and the keys, the viewpoints and the reset stop it. */ autoPlay?: boolean | "force"; /** Degrees of yaw a second the auto-turn goes by: 12 by default, positive turning the near side to the right as a drag to the right does, negative the other way. */ speed?: number; /** Called with `true` when the auto-turn starts and `false` when it stops, whatever stopped it. */ onPlayChange?: (playing: boolean) => void; /** Called after the view has changed by a key, a button or the pointer, with the view and the viewpoint it is (`undefined` when it has been turned by hand). */ onChange?: (view: TurnView, preset: TurnPreset | undefined) => void; } /** The pixels in one foot of the scene at a zoom of 1: the floor is drawn this big, and scaled down to fit. A larger floor is sharper. */ export declare const WORLD_PX = 1400; /** Everything a 3D view is made of. */ export interface TurnModel { id: string; language: Language; /** The options the floor is drawn from: the whole surface, lying wide. */ options: SurfaceOptions | ScoreOptions; title: string; /** What the drawing says, and then what stands on it. */ description: string; /** The sentence about what stands on the surface, or an empty string. */ standing: string; /** The floor: the markup of the flat drawing. */ floor: string; /** The floor's viewBox in feet. */ viewBox: { x: number; y: number; w: number; h: number; }; /** Pixels in a foot. */ scale: number; uprights: Uprights; /** The patterns the venue's planes are drawn with, and the crowd's colours (custom properties) they read: both empty when the view has no venue. */ defs: string; crowdStyle: string; /** Whether the venue is raised. */ venue: boolean; /** The sport and look the floor is painted in, when it has one (a budō surface's mats): the planes of its room are painted in the same look. */ look: { sport: string; look: string; } | undefined; planes: Plane[]; /** The whole scene in pixels, from its middle: the floor's rectangle, and the height of the highest thing. */ box: Box3; /** The middle of the floor, in feet. */ centre: [number, number]; view: TurnView; /** False when there is nothing to turn: a badge is a strip, not a surface. */ turnable: boolean; } /** The options with what makes the floor of a 3D view: the whole surface, lying wide, at its full size. */ export declare function floorOptions(options: SurfaceOptions | ScoreOptions): SurfaceOptions | ScoreOptions; /** The view a set of settings opens on. */ export declare const openingView: (settings: Pick, sport?: string) => TurnView; /** Work out a 3D view from the options of a drawing. */ export declare function buildTurn(options: SurfaceOptions | ScoreOptions, settings?: TurnSettings): TurnModel; /** The words of the 3D view in the model's language. */ export declare const turnWords: (model: Pick) => (typeof KYOGIJO_STRINGS)["en"]["turn"];