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

66 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-01-10 17:04:30 +01:00
/**
* This component makes the parentEntity (ex. car) follow the path provided by the spline
* @param id String
* @param name String
* @param domElementId
* @param camera
* @param parentEntity
* @constructor
*/
GameLib.D3.API.Input.Editor = function (
id,
name,
domElementId,
camera,
parentEntity
) {
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_INPUT_EDITOR,
{
'camera' : GameLib.D3.Camera
},
null,
parentEntity
);
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = this.constructor.name;
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(domElementId)) {
domElementId = 'divCanvas';
}
this.domElementId = domElementId;
if (GameLib.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
};
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.FromObjectComponent = function(objectComponent) {
return new GameLib.D3.API.Input.Editor(
objectComponent.id,
objectComponent.name,
objectComponent.domElementId,
objectComponent.camera,
objectComponent.parentEntity
);
};