UNPKG

@egjs/view360

Version:

360 integrated viewing solution from inside-out view to outside-in view. It provides user-friendly service by rotating 360 degrees through various user interaction such as motion sensor and touch.

99 lines (98 loc) 3 kB
import Component, { ComponentEvent } from "@egjs/component"; import { quat } from "gl-matrix"; import { ValueOf } from "../types/internal"; import { GYRO_MODE } from "./consts"; export interface YawPitchControlOptions { element: HTMLElement | null; yaw: number; pitch: number; fov: number; showPolePoint: boolean; useZoom: boolean; useKeyboard: boolean; gyroMode: ValueOf<typeof GYRO_MODE>; touchDirection: number; yawRange: number[]; pitchRange: number[]; fovRange: number[]; aspectRatio: number; } interface YawPitchControlEvents { change: ComponentEvent<{ yaw: number; pitch: number; fov: number; quaternion: quat | null; targetElement: HTMLElement; isTrusted: boolean; }>; hold: ComponentEvent<{ isTrusted: boolean; }>; animationEnd: ComponentEvent<{ isTrusted: boolean; }>; } declare class YawPitchControl extends Component<YawPitchControlEvents> { static VERSION: string; static CONTROL_MODE_VR: number; static CONTROL_MODE_YAWPITCH: number; static TOUCH_DIRECTION_ALL: number; static TOUCH_DIRECTION_YAW: number; static TOUCH_DIRECTION_PITCH: number; static TOUCH_DIRECTION_NONE: number; options: YawPitchControlOptions; private _element; private _initialFov; private _enabled; private _isAnimating; private _deviceQuaternion; private _axes; private _axesPanInput; private _axesWheelInput; private _axesTiltMotionInput; private _axesPinchInput; private _axesMoveKeyInput; constructor(options: Partial<YawPitchControlOptions>); updatePanScale(param?: Partial<{ height: number; }>): this; option(): YawPitchControlOptions; option<K extends keyof YawPitchControlOptions>(key: K): YawPitchControlOptions[K]; option<K extends keyof YawPitchControlOptions>(key: K, newValue: YawPitchControlOptions[K]): YawPitchControl; option(newOptions: Partial<YawPitchControlOptions>): YawPitchControl; enable(): this; disable(persistOrientation?: boolean): this; lookAt({ yaw, pitch, fov }: { yaw: any; pitch: any; fov: any; }, duration: any): void; getYawPitch(): { yaw: number; pitch: number; }; getFov(): number; getQuaternion(): import("gl-matrix").mat2; shouldRenderWithQuaternion(): boolean; destroy(): void; private _initAxes; private _getValidatedOptions; private _getOptions; private _setOptions; private _applyOptions; private _togglePinchInputByOption; private _enableTouch; private _initDeviceQuaternion; private _getValidYawRange; private _getValidPitchRange; private _isCircular; private _updateControlScale; private _updatePitchRange; private _updateYawRange; private _triggerChange; private _adjustAspectRatio; private _lerp; private _resetOrientation; } export default YawPitchControl;