/** * This component makes the parentEntity (ex. car) follow the path provided by the spline * @param id String * @param name String * @param domElementId * @param domContainerId * @param editor GameLib.D3.API.Editor * @param camera * @param widthOffset * @param heightOffset * @param containerWidthOffset * @param containerHeightOffset * @param selectDelayMs * @param parentEntity * @constructor */ GameLib.D3.API.Input.Editor = function ( id, name, domElementId, domContainerId, editor, camera, widthOffset, heightOffset, containerWidthOffset, containerHeightOffset, selectDelayMs, parentEntity ) { GameLib.Component.call( this, GameLib.Component.COMPONENT_INPUT_EDITOR, { 'editor' : GameLib.D3.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 = 'Input Editor (' + this.id + ')'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(domElementId)) { domElementId = 'divCanvas'; } this.domElementId = domElementId; if (GameLib.Utils.UndefinedOrNull(domContainerId)) { domContainerId = 'divContainer'; } this.domContainerId = domContainerId; if (GameLib.Utils.UndefinedOrNull(editor)) { editor = null; } this.editor = editor; if (GameLib.Utils.UndefinedOrNull(camera)) { camera = null; } this.camera = camera; if (GameLib.Utils.UndefinedOrNull(widthOffset)) { widthOffset = 400; } this.widthOffset = widthOffset; if (GameLib.Utils.UndefinedOrNull(heightOffset)) { heightOffset = 0; } this.heightOffset = heightOffset; if (GameLib.Utils.UndefinedOrNull(containerWidthOffset)) { containerWidthOffset = 0; } this.containerWidthOffset = containerWidthOffset; if (GameLib.Utils.UndefinedOrNull(containerHeightOffset)) { containerHeightOffset = 80; } this.containerHeightOffset = containerHeightOffset; if (GameLib.Utils.UndefinedOrNull(selectDelayMs)) { selectDelayMs = 300; } this.selectDelayMs = selectDelayMs; }; 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.domContainerId, objectComponent.editor, objectComponent.camera, objectComponent.widthOffset, objectComponent.heightOffset, objectComponent.containerWidthOffset, objectComponent.containerHeightOffset, objectComponent.selectDelayMs, objectComponent.parentEntity ); };