Events
To add an event listener, use World3D.addEventListener(type, callback).
callback is given a single object argument event, in which there are properties called type and optional value.
event.type is the name of the event. Optional event.value is the changed value when the event was fired.
MEASUREMENT_OBJECT_SELECTED
Fires when a MeasuringObject is selected in measurement:select mode.
- event.value: selected
MeasuringObject
MEASUREMENT_OBJECT_UNSELECTED
Fires if there’s currently a selected
MeasuringObjectand when user starts dragging a dot inmeasurement:selectmode.Fires when
Floor.modechanges frommeasurement:selectmode to eithernavigationormeasurement:measuremode if there's currently a selectedMeasuringObject.event.value: unselected
MeasuringObject
MEASUREMENT_OBJECT_REMOVED
Fires when the selected object is removed.
- event.value:
undefined
TO_NEXT_CUBE:NEXT_CUBE_DELAYED
Fires when cube-to-cube transition is in process and the next cube’s Cube.init() takes too long. Timeout time is adjustable through Options.transition.cubeToCube.waitTriggerMS.
- event.value:
undefined
TO_NEXT_CUBE:NEXT_CUBE_INITIALIZED
Fires when cube-to-cube transition is in process and the next cube’s Cube.init() is finally finished.
- event.value:
undefined
INITIAL_PROGRESS
Fires while World3D.init() is being executed.
- event.value:
number(0 - 100)
VIEW_CHANG
Fires when the value of World3D.view changes.
Note that if you want to change the value of World3D.view, use World3D.setView() instead of assigning the value directly. The setter is internal use only.
- event.value: changed view (
“cube” | “dollhouse”)
MODE_CHANGE
Fires when the value of World3D.mode changes. Unlike World3D.view, you can assign the new value directly.
- event.value: changed mode (
"navigation" | "measurement:measure" | "measurement:select")
FLOOR_CHANGE
Fires when World3D.currentFloor is changed as a result of World3D.setCurrentFloor().
- event.value: changed
Floor
SPOT_CHANGE
Fires when Floor.currentCube is changed as a result of calling World3D.goToCube().
- event.value: changed spot’s
id
IS_TRANSITIONING
Fires when camera transitioning happens. To see when exactly this event fires, set Options.logEvents to true and examine the console logs.
- event.value:
trueat the start andfalseat the end
ORBIT_CONTROLS_UPDATE
Fires whenever the position of camera is manipulated by OrbitControls.
- event.value:
OrbitControlsinstance