Reference Source
public class | source

AxisGizmoPlugin

Extends:

Plugin → AxisGizmoPlugin

Viewer plugin that shows the axii of the World-space coordinate system.

Usage

[Run this example]

import {Viewer} from "../src/viewer/Viewer.js";
import {GLTFLoaderPlugin} from "../src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js";
import {AxisGizmoPlugin} from "../src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js";

const viewer = new Viewer({
    canvasId: "myCanvas"
});

const gltfLoader = new GLTFLoaderPlugin(viewer);

new AxisGizmoPlugin(viewer, {size: [250, 250]});

const model = gltfLoader.load({
    id: "myModel",
    src: "./models/gltf/schependomlaan/scene.gltf",
    metaModelSrc: "./metaModels/schependomlaan/metaModel.json",
    edges: true
});

const scene = viewer.scene;
const camera = scene.camera;

camera.orbitPitch(20);

model.on("loaded", () => {
    viewer.cameraFlight.jumpTo(modelNode);
    scene.on("tick", () => {
       camera.orbitYaw(0.4);
    })
});

Constructor Summary

Public Constructor
public

constructor(viewer: Viewer, cfg: Object)

Method Summary

Public Methods
public

Destroys this AxisGizmoPlugin.

public

setVisible(visible: *)

Shows or hides this helper

Inherited Summary

From class Plugin
public

ID for this Plugin, unique within its Viewer.

public

The Viewer that contains this Plugin.

public

Destroys this Plugin and removes it from its Viewer.

public

error(msg: String)

Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

fire(event: String, value: Object)

Fires an event at this Plugin.

public

log(msg: String)

Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

on(event: String, callback: Function)

Subscribes to an event fired at this Plugin.

public

warn(msg: String)

Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

Public Constructors

public constructor(viewer: Viewer, cfg: Object) source

Creates this Plugin and installs it into the given Viewer.

Override:

Plugin#constructor

Params:

NameTypeAttributeDescription
viewer Viewer

The Viewer.

cfg Object

Plugin configuration.

cfg.id String
  • optional
  • default: "AxisGizmo"

Optional ID for this plugin, so that we can find it within Viewer#plugins.

cfg.size Number[]
  • optional
  • default: [250,250]

Initial size in pixels.

Public Methods

public destroy() source

Destroys this AxisGizmoPlugin.

Override:

Plugin#destroy

public setVisible(visible: *) source

Shows or hides this helper

Params:

NameTypeAttributeDescription
visible *