UNPKG

threepipe

Version:

A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.

29 lines (25 loc) 874 B
import {AViewerPluginSync, ThreeViewer} from '../../viewer' import {serialize} from 'ts-browser-helpers' export class ViewerUiConfigPlugin extends AViewerPluginSync<''> { static readonly PluginType = 'ViewerUiConfigPlugin' enabled = true serializeWithViewer = false constructor() { super() this.uiConfig = {} } onAdded(viewer: ThreeViewer) { super.onAdded(viewer) this.uiConfig = viewer.uiConfig this.uiConfig.expanded = true } @serialize('viewer') declare protected _viewer: ThreeViewer | undefined // todo: fix deserialization throwing error // toJSON(): any { // return this._viewer?.toJSON() ?? {} // } // fromJSON(data: ISerializedViewerConfig, meta?: SerializationMetaType): this | null { // this._viewer?.fromJSON(data, meta) // return this // } }