import { DIVE, DIVENode, PointerInput } from '../../../index.ts'; import { OrbitController } from '../../orbitcontroller/index.ts'; import { State, StateData } from '../../state/index.ts'; import { QuickViewSettings } from '../types/index.ts'; /** * What {@link QuickView} hands back. * * Named after the factory, and declared in the same module so it can be: a * function lives in the value namespace and a type in the type one, so one * import and no `type` keyword covers both. * * import { QuickView } from '@shopware-ag/dive/quickview'; * const view: Ref = ref(null); * * One type, because a QuickView can hold either kind of source and can be handed * the other one later -- {@link load} takes whatever {@link QuickView} takes. So * which of {@link model} and {@link state} is there is a question about right * now, not about how the view was built, and both are therefore nullable rather * than promised. */ export type QuickView = DIVE & { orbitController: OrbitController; /** Mouse and touch on the canvas, driving the {@link orbitController}. */ pointerInput: PointerInput; /** Which controller moves the camera right now. */ readonly activeController: QuickViewController; /** * Hands the camera to another controller. Exactly one is active at a time. * * `'gyro'` turns the camera by how the device is tilted, around the pose the * first load was framed in. It needs the orientation sensor, which iOS only * grants from inside a user gesture -- call this straight from the click * handler. It rejects, and the previous controller stays, when the sensor is * refused or reports nothing. * * `'gyro'` is experimental, see `GyroInput` and `TiltController`: how it * feels may change without a major release. * * @param kind - The controller to use. */ useController: (kind: QuickViewController) => Promise; /** The node the model sits on, or `null` while a scene state is loaded. */ readonly model: DIVENode | null; /** The state driving the scene, or `null` while a single model is loaded. */ readonly state: State | null; /** * Puts something else in front of the viewer. * * Takes the same sources the factory does, and replaces whatever is loaded -- * including across kinds: a QuickView built from a URI can be handed scene * state and the other way round. The previous source is torn down first, its * GPU resources included. * * @param source - A model URI, or the scene data to apply. */ load: (source: string | StateData) => Promise; }; /** * The controllers a {@link QuickView} can hand its camera to. `'gyro'` is * experimental. */ export type QuickViewController = 'orbit' | 'gyro'; export declare const QuickViewDefaultSettings: Required; /** * Creates a QuickView from a model URI or from scene data. * * @param source - A model URI, or the scene data to display. * @param settings - The settings for the QuickView. */ export declare function QuickView(source: string | StateData, settings?: Partial): Promise;