/** * Input parent class * @param graphics R3.D3.Graphics * @param parentObject * @param apiInputEditor R3.D3.API.Input.Editor * @constructor */ R3.D3.Input.Editor = function RuntimeEditorInput( graphics, parentObject, apiInputEditor ) { this.graphics = graphics; this.graphics.isNotThreeThrow(); if (R3.Utils.UndefinedOrNull(parentObject)) { parentObject = null; } this.parentObject = parentObject; R3.D3.API.Input.Editor.call( this, apiInputEditor.id, apiInputEditor.name, apiInputEditor.domElementId, apiInputEditor.camera, apiInputEditor.parentEntity ); /** * Don't create an instance here - since we don't have our camera loaded yet... */ }; 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(update) { var instance = null; if (this.camera && this.domElementId) { instance = new THREE.EditorControls( this.camera.instance, document.getElementById(this.domElementId) ); } this.instance = instance; return instance; }; R3.D3.Input.Editor.prototype.updateInstance = function() { this.instance = this.createInstance(true); }; R3.D3.Input.Editor.prototype.toApiComponent = 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.FromObjectComponent = function(graphics, objectComponent) { var apiInputEditor = new R3.D3.API.Input.Editor( objectComponent.id, objectComponent.name, objectComponent.domElementId, objectComponent.camera, objectComponent.parentEntity ); return new R3.D3.Input.Editor( graphics, this, apiInputEditor ); };