r3-legacy/bak/game-lib-d3-api-input-edito...

63 lines
1.5 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
*/
GameLib.D3.API.Input.Editor = function (
id,
name,
domElement,
camera,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Input Editor (' + this.id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(domElement)) {
domElement = null;
}
this.domElement = domElement;
if (GameLib.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
};
GameLib.D3.API.Input.Editor.prototype = Object.create(GameLib.Component.prototype);
GameLib.D3.API.Input.Editor.prototype.constructor = GameLib.D3.API.Input.Editor;
/**
* Object to GameLib.D3.API.Input.Editor
* @param objectComponent
* @returns {GameLib.D3.API.Input.Editor}
* @constructor
*/
GameLib.D3.API.Input.Editor.FromObject = function(objectComponent) {
return new GameLib.D3.API.Input.Editor(
objectComponent.id,
objectComponent.name,
objectComponent.domElement,
objectComponent.camera,
objectComponent.parentEntity
);
};