|
|
|
|
|
|
|
|
import {onChange, serializable, serialize} from 'ts-browser-helpers' |
|
|
import {onChange, serializable, serialize} from 'ts-browser-helpers' |
|
|
import {IUiConfigContainer, uiButton, uiInput, uiNumber, UiObjectConfig, uiPanelContainer, uiVector} from 'uiconfig.js' |
|
|
import {IUiConfigContainer, uiButton, uiInput, uiNumber, UiObjectConfig, uiPanelContainer, uiVector} from 'uiconfig.js' |
|
|
import {ICamera} from '../ICamera' |
|
|
import {ICamera} from '../ICamera' |
|
|
|
|
|
import {generateUUID} from '../../three' |
|
|
|
|
|
|
|
|
export interface ICameraView{ |
|
|
|
|
|
|
|
|
export interface ICameraView extends IUiConfigContainer{ |
|
|
name: string |
|
|
name: string |
|
|
position: Vector3 |
|
|
position: Vector3 |
|
|
target: Vector3 |
|
|
target: Vector3 |
|
|
quaternion: Quaternion |
|
|
quaternion: Quaternion |
|
|
zoom: number |
|
|
zoom: number |
|
|
|
|
|
isWorldSpace?: boolean |
|
|
animate(camera?: ICamera, duration?: number): void |
|
|
animate(camera?: ICamera, duration?: number): void |
|
|
set(camera?: ICamera): void |
|
|
set(camera?: ICamera): void |
|
|
|
|
|
update(camera?: ICamera): void |
|
|
|
|
|
delete(camera?: ICamera): void |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@serializable('CameraView') |
|
|
@serializable('CameraView') |
|
|
@uiPanelContainer('Camera View') |
|
|
@uiPanelContainer('Camera View') |
|
|
export class CameraView extends EventDispatcher<Event, 'setView'|'animateView'> implements ICameraView, IUiConfigContainer { |
|
|
|
|
|
|
|
|
export class CameraView extends EventDispatcher<Event, 'setView'|'animateView'|'updateView'|'deleteView'> implements ICameraView, IUiConfigContainer { |
|
|
|
|
|
uuid = generateUUID() |
|
|
@onChange(CameraView.prototype._nameChanged) |
|
|
@onChange(CameraView.prototype._nameChanged) |
|
|
@serialize() @uiInput() name = 'Camera View' |
|
|
@serialize() @uiInput() name = 'Camera View' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@serialize() @uiVector() target = new Vector3() |
|
|
@serialize() @uiVector() target = new Vector3() |
|
|
@serialize() @uiVector() quaternion = new Quaternion() |
|
|
@serialize() @uiVector() quaternion = new Quaternion() |
|
|
@serialize() @uiNumber() zoom = 1 |
|
|
@serialize() @uiNumber() zoom = 1 |
|
|
|
|
|
@serialize() isWorldSpace = true |
|
|
|
|
|
|
|
|
@uiButton() set = (camera?: ICamera) => this.dispatchEvent({type: 'setView', camera, view: this}) |
|
|
@uiButton() set = (camera?: ICamera) => this.dispatchEvent({type: 'setView', camera, view: this}) |
|
|
|
|
|
@uiButton() update = (camera?: ICamera) => this.dispatchEvent({type: 'updateView', camera, view: this}) |
|
|
|
|
|
@uiButton() delete = (camera?: ICamera) => this.dispatchEvent({type: 'deleteView', camera, view: this}) |
|
|
@uiButton() animate = (camera?: ICamera, duration?: number) => this.dispatchEvent({type: 'animateView', camera, duration, view: this}) |
|
|
@uiButton() animate = (camera?: ICamera, duration?: number) => this.dispatchEvent({type: 'animateView', camera, duration, view: this}) |
|
|
|
|
|
|
|
|
constructor(name?: string, position?: Vector3, target?: Vector3, quaternion?: Quaternion, zoom?: number) { |
|
|
constructor(name?: string, position?: Vector3, target?: Vector3, quaternion?: Quaternion, zoom?: number) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uiConfig?: UiObjectConfig |
|
|
uiConfig?: UiObjectConfig |
|
|
// uiConfig = generateUiFolder(this.name, this) |
|
|
// uiConfig = generateUiFolder(this.name, this) |
|
|
|
|
|
|
|
|
} |
|
|
} |