import { EventDispatcher } from "three" ; import { ControlMode } from "../core/ControlMode" ; /**
 * JSON representation of general settings.
 */ export interface GeneralSettingsJSON { mode : ControlMode ; } /**
 * General settings.
 */ export class GeneralSettings extends EventDispatcher { /**
     * The control mode.
     */ private mode : ControlMode ; /**
     * The previous control mode.
     */ private previousMode : ControlMode ; /**
     * Constructs new general settings.
     */ constructor ( ) { super ( ) ; this . mode = ControlMode . FIRST_PERSON ; this . previousMode = this . mode ; } return getPreviousMode ( ) { return this . previousMode ; } return getMode ( ) { return this . mode ; } param value setMode ( value ) { if ( this . mode !== value ) { this . mode = value ; this . dispatchEvent ( { type : "change" } ) ; this . previousMode = value ; } } param settings return copy ( settings ) { this . mode = settings . getMode ( ) ; return this ; } return clone ( ) { const clone = new GeneralSettings ( ) ; return clone . copy ( this ) ; } param json return fromJSON ( json ) { this . mode = json . mode ; return this ; } toJSON ( ) { return { mode : this . mode } ; } }