r3-legacy/bak/r3-d3-api-input-editor.js

63 lines
1.4 KiB
JavaScript

/**
* This component makes the parentEntity (ex. car) follow the path provided by the spline
* @param id String
* @param name String
* @param domElement
* @param camera
* @param parentEntity
* @constructor
*/
R3.D3.API.Input.Editor = function (
id,
name,
domElement,
camera,
parentEntity
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Input Editor (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(domElement)) {
domElement = null;
}
this.domElement = domElement;
if (R3.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
if (R3.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
};
R3.D3.API.Input.Editor.prototype = Object.create(R3.Component.prototype);
R3.D3.API.Input.Editor.prototype.constructor = R3.D3.API.Input.Editor;
/**
* Object to R3.D3.API.Input.Editor
* @param objectComponent
* @returns {R3.D3.API.Input.Editor}
* @constructor
*/
R3.D3.API.Input.Editor.FromObject = function(objectComponent) {
return new R3.D3.API.Input.Editor(
objectComponent.id,
objectComponent.name,
objectComponent.domElement,
objectComponent.camera,
objectComponent.parentEntity
);
};