91 lines
2.0 KiB
JavaScript
91 lines
2.0 KiB
JavaScript
|
/**
|
||
|
* Input parent class
|
||
|
* @param graphics R3.D3.Graphics
|
||
|
* @param apiInputEditor R3.D3.API.Input.Editor
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.D3.Input.Editor = function (
|
||
|
graphics,
|
||
|
apiInputEditor
|
||
|
) {
|
||
|
|
||
|
this.graphics = graphics;
|
||
|
this.graphics.isNotThreeThrow();
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(apiInputEditor)) {
|
||
|
apiInputEditor = {};
|
||
|
}
|
||
|
|
||
|
if (apiInputEditor instanceof R3.D3.Input.Editor) {
|
||
|
return apiInputEditor;
|
||
|
}
|
||
|
|
||
|
R3.D3.API.Input.Editor.call(
|
||
|
this,
|
||
|
apiInputEditor.id,
|
||
|
apiInputEditor.name,
|
||
|
apiInputEditor.domElement,
|
||
|
apiInputEditor.camera,
|
||
|
apiInputEditor.parentEntity
|
||
|
);
|
||
|
|
||
|
if (this.domElement instanceof R3.API.DomElement) {
|
||
|
this.domElement = new R3.DomElement(
|
||
|
this.domElement
|
||
|
)
|
||
|
}
|
||
|
|
||
|
if (this.camera instanceof R3.D3.API.Camera) {
|
||
|
this.camera = new R3.D3.Camera(
|
||
|
this.graphics,
|
||
|
this.camera
|
||
|
)
|
||
|
}
|
||
|
|
||
|
R3.Component.call(
|
||
|
this,
|
||
|
R3.Component.COMPONENT_INPUT_EDITOR,
|
||
|
{
|
||
|
'camera' : R3.D3.Camera
|
||
|
}
|
||
|
);
|
||
|
};
|
||
|
|
||
|
R3.D3.Input.Editor.prototype = Object.create(R3.D3.API.Input.Editor.prototype);
|
||
|
R3.D3.Input.Editor.prototype.constructor = R3.D3.Input.Editor;
|
||
|
|
||
|
R3.D3.Input.Editor.prototype.createInstance = function() {
|
||
|
return true;
|
||
|
};
|
||
|
|
||
|
R3.D3.Input.Editor.prototype.updateInstance = function() {
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* R3.D3.Input.Editor to R3.D3.API.Input.Editor
|
||
|
* @returns {R3.D3.API.Input.Editor}
|
||
|
*/
|
||
|
R3.D3.Input.Editor.prototype.toApiObject = function() {
|
||
|
|
||
|
var apiInputEditor = new R3.D3.API.Input.Editor(
|
||
|
this.id,
|
||
|
this.name,
|
||
|
this.domElementId,
|
||
|
R3.Utils.IdOrNull(this.camera),
|
||
|
R3.Utils.IdOrNull(this.parentEntity)
|
||
|
);
|
||
|
|
||
|
return apiInputEditor;
|
||
|
};
|
||
|
|
||
|
R3.D3.Input.Editor.FromObject = function(graphics, objectComponent) {
|
||
|
|
||
|
var apiInputEditor = R3.D3.API.Input.Editor.FromObject(objectComponent);
|
||
|
|
||
|
return new R3.D3.Input.Editor(
|
||
|
graphics,
|
||
|
apiInputEditor
|
||
|
);
|
||
|
};
|
||
|
|