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

63 lines
1.4 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
2017-02-21 18:55:18 +01:00
* @param domElement
2017-01-10 17:04:30 +01:00
* @param camera
* @param parentEntity
* @constructor
*/
2018-04-09 10:05:13 +02:00
R3.D3.API.Input.Editor = function (
2017-01-10 17:04:30 +01:00
id,
name,
2017-02-21 18:55:18 +01:00
domElement,
2017-01-10 17:04:30 +01:00
camera,
parentEntity
) {
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
2017-01-10 17:04:30 +01:00
}
this.id = id;
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(name)) {
2017-01-13 16:19:51 +01:00
name = 'Input Editor (' + this.id + ')';
2017-01-10 17:04:30 +01:00
}
this.name = name;
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(domElement)) {
2017-02-21 18:55:18 +01:00
domElement = null;
2017-01-10 17:04:30 +01:00
}
2017-02-21 18:55:18 +01:00
this.domElement = domElement;
2017-01-13 16:19:51 +01:00
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(camera)) {
2017-01-10 17:04:30 +01:00
camera = null;
}
this.camera = camera;
2017-01-12 17:40:17 +01:00
2018-04-09 10:05:13 +02:00
if (R3.Utils.UndefinedOrNull(parentEntity)) {
2017-06-16 15:49:53 +02:00
parentEntity = null;
}
this.parentEntity = parentEntity;
2017-01-10 17:04:30 +01:00
};
2018-04-09 10:05:13 +02:00
R3.D3.API.Input.Editor.prototype = Object.create(R3.Component.prototype);
R3.D3.API.Input.Editor.prototype.constructor = R3.D3.API.Input.Editor;
2017-01-10 17:04:30 +01:00
/**
2018-04-09 10:05:13 +02:00
* Object to R3.D3.API.Input.Editor
2017-01-10 17:04:30 +01:00
* @param objectComponent
2018-04-09 10:05:13 +02:00
* @returns {R3.D3.API.Input.Editor}
2017-01-10 17:04:30 +01:00
* @constructor
*/
2018-04-09 10:05:13 +02:00
R3.D3.API.Input.Editor.FromObject = function(objectComponent) {
return new R3.D3.API.Input.Editor(
2017-01-10 17:04:30 +01:00
objectComponent.id,
objectComponent.name,
2017-02-21 18:55:18 +01:00
objectComponent.domElement,
2017-01-10 17:04:30 +01:00
objectComponent.camera,
objectComponent.parentEntity
);
};