import { EventDispatcher } from "three" ; /**
 * JSON representation of zoom settings.
 */ export interface ZoomSettingsJSON { enabled : boolean ; inverted : boolean ; minDistance : number ; maxDistance : number ; sensitivity : number ; damping : number ; } /**
 * Zoom settings.
 */ export class ZoomSettings extends EventDispatcher { /**
     * Whether zooming is enabled.
     */ private enabled : boolean ; /**
     * Indicates whether the zoom controls should be inverted.
     */ private inverted : boolean ; /**
     * The minimum zoom distance.
     */ private minDistance : number ; /**
     * The maximum zoom distance.
     */ private maxDistance : number ; /**
     * The zoom sensitivity.
     */ private sensitivity : number ; /**
     * The damping factor. Range is [0.0, +Infinity]. Set to 0 to disable.
     */ private damping : number ; /**
     * Constructs new zoom settings.
     */ constructor ( ) { super ( ) ; this . enabled = true ; this . inverted = false ; this . minDistance = 1e-6 ; this . maxDistance = Number . POSITIVE_INFINITY ; this . sensitivity = 1.0 ; this . damping = 0.0 ; } return isEnabled ( ) { return this . enabled ; } param value setEnabled ( value ) { this . enabled = value ; this . dispatchEvent ( { type : "change" } ) ; } return isInverted ( ) { return this . inverted ; } param value setInverted ( value ) { this . inverted = value ; this . dispatchEvent ( { type : "change" } ) ; } return getMinDistance ( ) { return this . minDistance ; } param value setMinDistance ( value ) { this . minDistance = Math . min ( Math . max ( value , 1e-6 ) , Number . POSITIVE_INFINITY ) ; this . dispatchEvent ( { type : "change" } ) ; } return getMaxDistance ( ) { return this . maxDistance ; } param value setMaxDistance ( value ) { this . maxDistance = Math . min ( Math . max ( value , this . minDistance ) , Number . POSITIVE_INFINITY ) ; this . dispatchEvent ( { type : "change" } ) ; } param min param max setRange ( min , max ) { this . minDistance = min ; this . maxDistance = max ; this . dispatchEvent ( { type : "change" } ) ; } return getSensitivity ( ) { return this . sensitivity ; } param value setSensitivity ( value ) { this . sensitivity = value ; this . dispatchEvent ( { type : "change" } ) ; } return getDamping ( ) { return this . damping ; } param value setDamping ( value ) { this . damping = value ; this . dispatchEvent ( { type : "change" } ) ; } param settings return copy ( settings ) { this . enabled = settings . isEnabled ( ) ; this . inverted = settings . isInverted ( ) ; this . minDistance = settings . getMinDistance ( ) ; this . maxDistance = settings . getMaxDistance ( ) ; this . sensitivity = settings . getSensitivity ( ) ; this . damping = settings . getDamping ( ) ; return this ; } return clone ( ) { const clone = new ZoomSettings ( ) ; return clone . copy ( this ) ; } param json return fromJSON ( json ) { this . enabled = json . enabled ; this . inverted = json . inverted ; this . minDistance = json . minDistance ; this . maxDistance = json . maxDistance || Number . POSITIVE_INFINITY ; this . sensitivity = json . sensitivity ; this . damping = json . damping ; return this ; } toJSON ( ) { return { enabled : this . enabled , inverted : this . inverted , minDistance : this . minDistance , maxDistance : this . maxDistance , sensitivity : this . sensitivity , damping : this . damping } ; } }