Options
All
  • Public
  • Public/Protected
  • All
Menu

Controls the Camera with user input, and fires events when the user interacts with pickable Entitys.

Hierarchy

Index

Constructors

Properties

AXIS_VIEW_BACK: number
AXIS_VIEW_BOTTOM: number
AXIS_VIEW_FRONT: number
AXIS_VIEW_LEFT: number
AXIS_VIEW_RIGHT: number
AXIS_VIEW_TOP: number
DOLLY_BACKWARDS: number
DOLLY_FORWARDS: number
PAN_BACKWARDS: number
PAN_DOWN: number
PAN_FORWARDS: number
PAN_LEFT: number
PAN_RIGHT: number
PAN_UP: number
ROTATE_X_NEG: number
ROTATE_X_POS: number
ROTATE_Y_NEG: number
ROTATE_Y_POS: number
id: string

ID of this Component, unique within the Scene.

Components are mapped by this ID in {@link Scene.components}.

property

id

meta: any

Arbitrary, user-defined metadata on this component.

property

metadata

scene: Scene

The parent Scene that contains this Component.

property

scene

final
viewer: Viewer

The viewer that contains this Scene.

property

viewer

Accessors

  • get active(): boolean
  • set active(arg: boolean): void
  • get constrainVertical(): boolean
  • set constrainVertical(arg: boolean): void
  • get dollyInertia(): number
  • set dollyInertia(arg: number): void
  • Gets the dolly inertia factor.

    Default is 0.

    Returns number

    The current dolly inertia factor.

  • Sets the dolly inertia factor.

    This factor configures how much the Camera keeps moving after you finish dollying it.

    This factor is a value in range [0..1]. A value of 0.0 causes dollying to immediately stop, 0.5 causes dollying to decay 50% on each animation frame, while 1.0 causes no decay, which allows dollying to continue until further input stops it.

    You might set dollyInertia to zero when you want be able to precisely position or rotate the Camera, without interference from inertia. This also means that xeokit renders less frames while dollying the Camera, which can improve rendering performance.

    Default is 0.

    Parameters

    • arg: number

    Returns void

  • get dollyMinSpeed(): number
  • set dollyMinSpeed(arg: number): void
  • get dollyProximityThreshold(): number
  • set dollyProximityThreshold(arg: number): void
  • get dollyToPointer(): boolean
  • set dollyToPointer(arg: boolean): void
  • get doublePickFlyTo(): boolean
  • set doublePickFlyTo(arg: boolean): void
  • get dragRotationRate(): number
  • set dragRotationRate(arg: number): void
  • Gets the current drag rotation rate.

    Default is 360.0.

    Returns number

    The current drag rotation rate.

  • Sets the current drag rotation rate.

    This configures how many degrees the Camera rotates/orbits for a full sweep of the canvas by mouse or touch dragging.

    For example, a value of 360.0 indicates that the Camera rotates/orbits 360.0 degrees horizontally when we sweep the entire width of the canvas.

    CameraControl makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to flip upside-down. Therefore, a value of 360.0 rotates/orbits the Camera through 180.0 degrees vertically when we sweep the entire height of the canvas.

    Default is 360.0.

    Parameters

    • arg: number

    Returns void

  • get firstPerson(): boolean
  • set firstPerson(arg: boolean): void
  • get followPointer(): boolean
  • set followPointer(arg: boolean): void
  • Sets whether the Camera follows the mouse/touch pointer.

    In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.

    In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.

    In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.

    Default is true.

    See class comments for more info.

    Returns boolean

    Returns true if the Camera follows the pointer.

  • Sets whether the Camera follows the mouse/touch pointer.

    In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.

    In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.

    In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.

    Default is true.

    See class comments for more info.

    Parameters

    • arg: boolean

    Returns void

  • get keyMap(): {}
  • set keyMap(arg: {}): void
  • get keyboardDollyRate(): number
  • set keyboardDollyRate(arg: number): void
  • get keyboardPanRate(): number
  • set keyboardPanRate(arg: number): void
  • Gets how much the Camera pans each second with keyboard input.

    Default is 5.0.

    Returns number

    The current keyboard pan rate.

  • Sets how much the Camera pans each second with keyboard input.

    Default is 5.0, to pan the Camera 5.0 World-space units every second that a panning key is depressed. See the CameraControl class documentation for which keys control panning.

    Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards and backwards, we pan along the direction the Camera is pointing.

    Unlike dollying when followPointer is true, panning does not follow the pointer.

    Parameters

    • arg: number

    Returns void

  • get keyboardRotationRate(): number
  • set keyboardRotationRate(arg: number): void
  • Sets how many degrees per second the Camera rotates/orbits with keyboard input.

    Default is 90.0.

    Returns number

    The current keyboard rotation rate.

  • Sets how many degrees per second the Camera rotates/orbits with keyboard input.

    Default is 90.0, to rotate/orbit the Camera 90.0 degrees every second that a rotation key is depressed. See the CameraControl class documentation for which keys control rotation/orbit.

    Parameters

    • arg: number

    Returns void

  • get mouseWheelDollyRate(): number
  • set mouseWheelDollyRate(arg: number): void
  • get navMode(): "orbit" | "firstPerson" | "planView"
  • set navMode(arg: "orbit" | "firstPerson" | "planView"): void
  • Gets the current navigation mode.

    Accepted values are:

    • "orbit" - rotation orbits about the current target or pivot point,
    • "firstPerson" - rotation is about the current eye position,
    • "planView" - rotation is disabled.

    See class comments for more info.

    Returns "orbit" | "firstPerson" | "planView"

    The navigation mode

  • Sets the current navigation mode.

    Accepted values are:

    • "orbit" - rotation orbits about the current target or pivot point,
    • "firstPerson" - rotation is about the current eye position,
    • "planView" - rotation is disabled.

    See class comments for more info.

    Parameters

    • arg: "orbit" | "firstPerson" | "planView"

    Returns void

  • The Component that owns the lifecycle of this Component, if any.

    When that component is destroyed, this component will be automatically destroyed also.

    Will be null if this Component has no owner.

    property

    owner

    Returns Component

  • get panInertia(): number
  • set panInertia(arg: number): void
  • Gets the pan inertia factor.

    Default is 0.5.

    Returns number

    The current pan inertia factor.

  • Sets the pan inertia factor.

    This factor configures how much the Camera keeps moving after you finish panning it.

    This factor is a value in range [0..1]. A value of 0.0 causes panning to immediately stop, 0.5 causes panning to decay 50% on each animation frame, while 1.0 causes no decay, which allows panning to continue until further input stops it.

    You might set panInertia to zero when you want be able to precisely position or rotate the Camera, without interference from inertia. This also means that xeokit renders less frames while panning the Camera, wich can improve rendering performance.

    Default is 0.5.

    Parameters

    • arg: number

    Returns void

  • get panRightClick(): boolean
  • set panRightClick(arg: boolean): void
  • get panToPointer(): boolean
  • set panToPointer(arg: boolean): void
  • set pivotElement(arg: HTMLElement): void
  • get pivotPos(): number[]
  • set pivotPos(arg: number[]): void
  • get pointerEnabled(): boolean
  • set pointerEnabled(arg: boolean): void
  • Gets whether mouse and touch input is enabled.

    Default is true.

    Disabling mouse and touch input on CameraControl is desirable when we want to temporarily use mouse or touch input to interact with some other 3D control, without interfering with the Camera.

    Returns boolean

    Returns true if mouse and touch input is enabled.

  • Sets whether mouse and touch input is enabled.

    Default is true.

    Disabling mouse and touch input on CameraControl is useful when we want to temporarily use mouse or touch input to interact with some other 3D control, without disturbing the Camera.

    Parameters

    • arg: boolean

    Returns void

  • get rotationInertia(): number
  • set rotationInertia(arg: number): void
  • Gets the rotation inertia factor.

    Default is 0.0.

    Does not apply when CameraControl.navMode is "planView", which disallows rotation.

    Returns number

    The inertia factor.

  • Sets a factor in range [0..1] indicating how much the Camera keeps moving after you finish rotating it.

    A value of 0.0 causes it to immediately stop, 0.5 causes its movement to decay 50% on each tick, while 1.0 causes no decay, allowing it continue moving, by the current rate of rotation.

    You may choose an inertia of zero when you want be able to precisely rotate the Camera, without interference from inertia. Zero inertia can also mean that less frames are rendered while you are rotating the Camera.

    Default is 0.0.

    Does not apply when CameraControl.navMode is "planView", which disallows rotation.

    Parameters

    • arg: number

    Returns void

  • get smartPivot(): boolean
  • set smartPivot(arg: boolean): void
  • Gets whether smart default pivoting is enabled.

    When true, we'll pivot by default about the 3D position of the mouse/touch pointer on an imaginary sphere that's centered at Camera.eye and sized to the Scene boundary.

    When false, we'll pivot by default about Camera.look.

    Default is false.

    Returns boolean

    Returns true when pivoting by default about the selected point on the virtual sphere, or false when pivoting by default about Camera.look.

  • Sets whether smart default pivoting is enabled.

    When true, we'll pivot by default about the 3D position of the mouse/touch pointer on an imaginary sphere that's centered at Camera.eye and sized to the Scene boundary.

    When false, we'll pivot by default about Camera.look.

    Default is false.

    Parameters

    • arg: boolean

    Returns void

  • get touchDollyRate(): number
  • set touchDollyRate(arg: number): void
  • get touchPanRate(): number
  • set touchPanRate(arg: number): void

Methods

  • clear(): void
  • destroy(): void
  • error(message: string): void
  • Logs an error for this component to the JavaScript console.

    The console message will have this format: [ERROR] [<component type> =<component id>: <message>

    Also fires the message as an "error" event on the parent Scene.

    Parameters

    • message: string

      The message to log

    Returns void

  • fire(event: string, value: any, forget?: boolean): void
  • Fires an event on this component.

    Notifies existing subscribers to the event, optionally retains the event to give to any subsequent notifications on the event as they are made.

    Parameters

    • event: string

      The event type name

    • value: any

      The event parameters

    • Optional forget: boolean

    Returns void

  • hasSubs(event: string): boolean
  • Returns true if there are any subscribers to the given event on this component.

    Parameters

    • event: string

      The event

    Returns boolean

    True if there are any subscribers to the given event on this component.

  • isType(type: any): boolean
  • log(message: string): void
  • Logs a console debugging message for this component.

    The console message will have this format: [LOG] [<component type> <component id>: <message>

    Also fires the message as a "log" event on the parent Scene.

    Parameters

    • message: string

      The message to log

    Returns void

  • off(subId: string): void
  • on(event: "rightClick", callback: (e: { canvasPos: number[]; event: MouseEvent; pagePos: number[] }) => void, scope?: any): string
  • on(event: "hover", callback: (e: PickResult) => void, scope?: any): string
  • on(event: "hoverOff", callback: (e: { canvasPos: number[] }) => void, scope?: any): string
  • on(event: "hoverEnter", callback: (e: PickResult) => void, scope?: any): string
  • on(event: "hoverOut", callback: (e: { entity: Entity }) => void, scope?: any): string
  • on(event: "picked", callback: (e: PickResult) => void, scope?: any): string
  • on(event: "pickedSurface", callback: (e: PickResult) => void, scope?: any): string
  • on(event: "pickedNothing", callback: (e?: { canvasPos: number[] }) => void, scope?: any): string
  • on(event: "doublePicked", callback: (e: PickResult) => void, scope?: any): string
  • on(event: "doublePickedSurface", callback: (e: PickResult) => void, scope?: any): string
  • on(event: "doublePickedNothing", callback: (e?: { canvasPos: number[] }) => void, scope?: any): string
  • Fires when the model is loaded

    Parameters

    • event: "rightClick"

      The loaded event

    • callback: (e: { canvasPos: number[]; event: MouseEvent; pagePos: number[] }) => void

      Called fired on the event

        • (e: { canvasPos: number[]; event: MouseEvent; pagePos: number[] }): void
        • Parameters

          • e: { canvasPos: number[]; event: MouseEvent; pagePos: number[] }
            • canvasPos: number[]
            • event: MouseEvent
            • pagePos: number[]

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when the pointer moves while hovering over an Entity.

    Parameters

    • event: "hover"

      The hover event

    • callback: (e: PickResult) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when the pointer moves while hovering over empty space.

    Parameters

    • event: "hoverOff"

      The hoverOff event

    • callback: (e: { canvasPos: number[] }) => void

      Called fired on the event

        • (e: { canvasPos: number[] }): void
        • Parameters

          • e: { canvasPos: number[] }
            • canvasPos: number[]

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when the pointer moves onto an Entity.

    Parameters

    • event: "hoverEnter"

      The hoverEnter event

    • callback: (e: PickResult) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when the pointer moves off an Entity.

    Parameters

    • event: "hoverOut"

      The hoverOut event

    • callback: (e: { entity: Entity }) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when we left-click or tap on an Entity.

    Parameters

    • event: "picked"

      The picked event

    • callback: (e: PickResult) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when we left-click or tap on the surface of an Entity.

    Parameters

    • event: "pickedSurface"

      The pickedSurface event

    • callback: (e: PickResult) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when we left-click or tap on empty space.

    Parameters

    • event: "pickedNothing"

      The pickedNothing event

    • callback: (e?: { canvasPos: number[] }) => void

      Called fired on the event

        • (e?: { canvasPos: number[] }): void
        • Parameters

          • Optional e: { canvasPos: number[] }
            • canvasPos: number[]

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired wwhen we left-double-click or double-tap on an Entity.

    Parameters

    • event: "doublePicked"

      The doublePicked event

    • callback: (e: PickResult) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when we left-double-click or double-tap on the surface of an Entity.

    Parameters

    • event: "doublePickedSurface"

      The doublePickedSurface event

    • callback: (e: PickResult) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

  • Event fired when we left-double-click or double-tap on empty space.

    Parameters

    • event: "doublePickedNothing"

      The doublePickedNothing event

    • callback: (e?: { canvasPos: number[] }) => void

      Called fired on the event

        • (e?: { canvasPos: number[] }): void
        • Parameters

          • Optional e: { canvasPos: number[] }
            • canvasPos: number[]

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • once(event: string, callback: Function, scope?: any): void
  • Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

    This is equivalent to calling Component.on, and then calling Component.off inside the callback function.

    Parameters

    • event: string

      Data event to listen to

    • callback: Function

      Called when fresh data is available at the event

    • Optional scope: any

    Returns void

  • warn(message: string): void
  • Logs a warning for this component to the JavaScript console.

    The console message will have this format: [WARN] [<component type> =<component id>: <message>

    Also fires the message as a "warn" event on the parent Scene.

    Parameters

    • message: string

      The message to log

    Returns void

Generated using TypeDoc