r3-legacy/src/game-lib-system-input.js

959 lines
24 KiB
JavaScript
Raw Normal View History

2017-06-19 15:54:02 +02:00
/**
* System takes care of updating all the entities (based on their component data)
* @param apiSystem GameLib.API.System
* @constructor
*/
GameLib.System.Input = function(
apiSystem
) {
GameLib.System.call(
this,
apiSystem
);
2017-08-24 22:20:40 +02:00
// this.meshMoveMode = false;
// this.meshMoveXMode = false;
// this.meshMoveYMode = false;
// this.meshMoveZMode = false;
2017-08-24 22:20:40 +02:00
/**
* We need new function pointers with scope bound to this so we can remove the
* window event handlers when we need to
* @type {function()}
*/
this.mouseMove = null;
this.mouseDown = null;
this.keyDown = null;
this.mouseUp = null;
this.mouseWheel = null;
this.selectAll = false;
this.controlLeft = false;
2017-09-29 06:55:42 +02:00
this.sensitivityCounter = 0;
this.renderers = [];
this.editorControls = [];
this.touchControls = [];
this.keyboardControls = [];
this.mouseControls = [];
2017-08-24 22:20:40 +02:00
2017-09-27 21:44:25 +02:00
this.touchStart = this.onTouchStart.bind(this);
this.touchMove = this.onTouchMove.bind(this);
this.touchEnd = this.onTouchEnd.bind(this);
this.touchCancel = this.onTouchCancel.bind(this);
2017-09-29 06:09:47 +02:00
this.keyboardKeyUp = this.onKeyboardKeyUp.bind(this);
this.keyboardKeyDown = this.onKeyboardKeyDown.bind(this);
2017-06-19 15:54:02 +02:00
};
GameLib.System.Input.prototype = Object.create(GameLib.System.prototype);
GameLib.System.Input.prototype.constructor = GameLib.System.Input;
2017-08-24 22:20:40 +02:00
/**
*
*/
2017-06-19 15:54:02 +02:00
GameLib.System.Input.prototype.start = function() {
GameLib.System.prototype.start.call(this);
this.editorControls = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Controls.Editor);
this.touchControls = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Controls.Touch);
this.keyboardControls = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Controls.Keyboard);
this.mouseControls = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Controls.Mouse);
/**
2017-09-28 12:03:59 +02:00
* If we have touch controls - inject them first so we can override editor controls if necessary
*/
2017-09-27 21:44:25 +02:00
if (this.touchControls.length > 0) {
2017-09-29 07:47:12 +02:00
this.sensitivityCounter = 0;
if (this.touchControls.length > 1) {
console.warn('too many touch controls - will use ' + this.touchControls[0].name)
}
var touchControl = this.touchControls[0];
this.touchSensitivity = touchControl.sensitivity;
touchControl.domElement.instance.addEventListener(
'touchstart',
this.touchStart,
false
);
touchControl.domElement.instance.addEventListener(
'touchmove',
this.touchMove,
false
);
touchControl.domElement.instance.addEventListener(
'touchend',
this.touchEnd,
false
);
touchControl.domElement.instance.addEventListener(
'touchcancel',
this.touchCancel,
false
);
2017-09-27 21:44:25 +02:00
2017-09-29 06:09:47 +02:00
}
/**
* Same for keyboard controls
*/
if (this.keyboardControls.length > 0) {
this.keyboardControls.map(
function(keyboardControl) {
keyboardControl.domElement.instance.addEventListener(
'keyup',
this.keyboardKeyUp,
false
);
keyboardControl.domElement.instance.addEventListener(
'keydown',
this.keyboardKeyDown,
false
);
}.bind(this)
)
}
if (this.editorControls.length > 0) {
2017-09-28 12:03:59 +02:00
this.renderers = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Renderer);
this.renderers.map(
function(renderer) {
renderer.controls = this.editorControls.reduce(
function(result, editorControl) {
if (editorControl.renderer === renderer) {
result = editorControl;
}
return result;
},
null
);
renderer.mouseDown = this.onMouseDown(renderer, renderer.controls).bind(this);
renderer.domElement.instance.addEventListener(
'mousedown',
renderer.mouseDown,
false
);
renderer.mouseMove = this.onMouseMove.bind(this);
renderer.domElement.instance.addEventListener(
'mousemove',
renderer.mouseMove,
false
);
renderer.keyDown = this.onKeyDown.bind(this);
renderer.domElement.instance.addEventListener(
'keydown',
renderer.keyDown,
false
);
renderer.keyUp = this.onKeyUp.bind(this);
renderer.domElement.instance.addEventListener(
'keyup',
renderer.keyUp,
false
);
if (renderer.controls) {
/**
* Create the delayed instance here - it affects the order of event listeners attached to DOM
*/
renderer.controls.instance = renderer.controls.delayedInstance();
} else {
console.warn('no third party controls for renderer : ' + renderer.name);
}
renderer.mouseWheel = this.onMouseWheel(renderer.camera).bind(this);
renderer.domElement.instance.addEventListener(
'mousewheel',
renderer.mouseWheel,
false
);
renderer.mouseUp = this.onMouseUp(renderer.camera, renderer.controls).bind(this);
renderer.domElement.instance.addEventListener(
'mouseup',
renderer.mouseUp,
false
);
}.bind(this)
);
2017-09-27 21:44:25 +02:00
}
2017-09-29 06:09:47 +02:00
};
2017-09-27 21:44:25 +02:00
2017-09-29 06:09:47 +02:00
GameLib.System.Input.prototype.onKeyboardKeyUp = function(event) {
GameLib.Event.Emit(
GameLib.Event.KEY_DOWN,
{
code : event.code
}
);
};
GameLib.System.Input.prototype.onKeyboardKeyDown = function(event) {
GameLib.Event.Emit(
GameLib.Event.KEY_UP,
{
code : event.code
}
);
2017-09-27 21:44:25 +02:00
};
2017-09-27 21:44:25 +02:00
GameLib.System.Input.prototype.onTouchStart = function(event) {
2017-09-29 06:55:42 +02:00
this.sensitivityCounter = 0;
2017-09-27 21:44:25 +02:00
this.touches = {};
for (var t = 0; t < event.touches.length; t++) {
this.touches[event.touches[t].identifier] = {
left : 0,
right : 0,
up : 0,
down : 0,
pageX : event.touches[t].pageX,
pageY : event.touches[t].pageY,
cancelled : false,
2017-09-29 06:26:40 +02:00
ended : false
2017-09-27 21:44:25 +02:00
};
}
2017-09-29 06:26:40 +02:00
this.touches.event = event;
2017-09-27 21:44:25 +02:00
GameLib.Event.Emit(
GameLib.Event.TOUCH_START,
this.touches
)
};
2017-09-29 07:47:12 +02:00
GameLib.System.Input.prototype.onTouchMove = function (event) {
2017-09-29 07:29:41 +02:00
2017-09-29 07:47:12 +02:00
this.sensitivityCounter++;
2017-09-27 21:44:25 +02:00
2017-09-29 08:08:41 +02:00
var id = null;
var t = null;
2017-09-29 07:47:12 +02:00
if (this.sensitivityCounter < this.touchSensitivity) {
/**
* ignore this event
*/
2017-09-29 08:08:41 +02:00
for (t = 0; t < event.changedTouches.length; t++) {
id = event.changedTouches[t].identifier;
this.touches[id].pageX = event.changedTouches[t].pageX;
this.touches[id].pageY = event.changedTouches[t].pageY;
}
2017-09-29 07:47:12 +02:00
} else {
2017-09-29 08:08:41 +02:00
2017-09-29 07:47:12 +02:00
this.sensitivityCounter = 0;
2017-09-29 07:29:41 +02:00
2017-09-27 21:44:25 +02:00
2017-09-29 08:08:41 +02:00
for (t = 0; t < event.changedTouches.length; t++) {
2017-09-29 06:55:42 +02:00
2017-09-29 08:08:41 +02:00
id = event.changedTouches[t].identifier;
2017-09-29 06:55:42 +02:00
2017-09-29 08:08:41 +02:00
var left = 0;
var right = 0;
var up = 0;
var down = 0;
2017-09-29 06:55:42 +02:00
2017-09-29 08:08:41 +02:00
if (event.changedTouches[t].pageX > this.touches[id].pageX) {
right += (event.changedTouches[t].pageX - this.touches[id].pageX);
2017-09-29 08:11:17 +02:00
// if (this.touches[id].left > 0) {
// this.touches[id].left = 0;
// this.sensitivityCounter = this.touchSensitivity;
// }
2017-09-29 06:55:42 +02:00
}
2017-09-29 08:08:41 +02:00
if (event.changedTouches[t].pageX < this.touches[id].pageX) {
left += (this.touches[id].pageX - event.changedTouches[t].pageX);
2017-09-29 08:11:17 +02:00
// if (this.touches[id].right > 0) {
// this.touches[id].right = 0;
// this.sensitivityCounter = this.touchSensitivity;
// }
2017-09-29 06:55:42 +02:00
}
2017-09-27 21:44:25 +02:00
2017-09-29 08:08:41 +02:00
if (event.changedTouches[t].pageY < this.touches[id].pageY) {
up += (this.touches[id].pageY - event.changedTouches[t].pageY);
2017-09-29 08:11:17 +02:00
// if (this.touches[id].down > 0) {
// this.touches[id].down = 0;
// this.sensitivityCounter = this.touchSensitivity;
// }
2017-09-29 06:55:42 +02:00
}
2017-09-27 21:44:25 +02:00
2017-09-29 08:08:41 +02:00
if (event.changedTouches[t].pageY > this.touches[id].pageY) {
down += (event.changedTouches[t].pageY - this.touches[id].pageY);
2017-09-29 08:11:17 +02:00
// if (this.touches[id].up > 0) {
// this.touches[id].up = 0;
// this.sensitivityCounter = this.touchSensitivity;
// }
2017-09-29 08:08:41 +02:00
}
2017-09-29 08:08:41 +02:00
this.touches[id].right += right;
this.touches[id].left += left;
this.touches[id].up += up;
this.touches[id].down += down;
this.touches[id].pageX = event.changedTouches[t].pageX;
this.touches[id].pageY = event.changedTouches[t].pageY;
}
2017-09-29 06:55:42 +02:00
2017-09-29 08:08:41 +02:00
this.touches.event = event;
2017-09-29 06:26:40 +02:00
2017-09-29 08:08:41 +02:00
GameLib.Event.Emit(
GameLib.Event.TOUCH_MOVE,
this.touches
);
}
2017-09-27 21:44:25 +02:00
};
2017-09-27 21:44:25 +02:00
GameLib.System.Input.prototype.onTouchCancel = function(event) {
2017-09-29 07:29:41 +02:00
this.sensitivityCounter = 0;
2017-09-27 21:44:25 +02:00
for (var t = 0; t < event.changedTouches.length; t++) {
this.touches[event.changedTouches[t].identifier].cancelled = true;
2017-09-28 12:03:59 +02:00
this.touches[event.changedTouches[t].identifier].event = event;
2017-09-27 21:44:25 +02:00
GameLib.Event.Emit(
GameLib.Event.TOUCH_CANCEL,
this.touches[event.changedTouches[t].identifier]
);
delete this.touches[event.changedTouches[t].identifier];
}
2017-08-24 22:20:40 +02:00
};
2017-09-27 21:44:25 +02:00
GameLib.System.Input.prototype.onTouchEnd = function(event) {
2017-09-29 07:29:41 +02:00
this.sensitivityCounter = 0;
2017-09-27 21:44:25 +02:00
for (var t = 0; t < event.changedTouches.length; t++) {
this.touches[event.changedTouches[t].identifier].ended = true;
2017-09-28 12:03:59 +02:00
this.touches[event.changedTouches[t].identifier].event = event;
2017-09-27 21:44:25 +02:00
GameLib.Event.Emit(
GameLib.Event.TOUCH_END,
this.touches[event.changedTouches[t].identifier]
);
delete this.touches[event.changedTouches[t].identifier];
}
};
2017-08-24 22:20:40 +02:00
GameLib.System.Input.prototype.onKeyDown = function(event) {
console.log('input system emitted keypress ' + event.code);
GameLib.Event.Emit(
GameLib.Event.KEY_DOWN,
{
code : event.code
}
);
var meshes = null;
if (event.code === 'Delete') {
meshes = GameLib.EntityManager.Instance.queryComponents([GameLib.D3.Mesh]);
var deletedMeshes = [];
meshes.map(
function(mesh) {
if (mesh.selected) {
deletedMeshes.push(mesh);
mesh.removeHelper();
var scene = mesh.parentScene;
scene.removeObject(mesh);
scene.buildIdToObject();
}
}.bind(this)
);
GameLib.Event.Emit(
GameLib.Event.MESH_DELETED,
{
meshes : deletedMeshes
}
);
}
if (event.code === 'ControlLeft') {
this.controlLeft = true;
}
if (event.code === 'KeyA') {
this.selectAll = !this.selectAll;
meshes = GameLib.EntityManager.Instance.queryComponents([GameLib.D3.Mesh]);
meshes.map(function(mesh){
if (this.selectAll) {
this.selectMesh(mesh);
} else {
this.deSelectMesh(mesh);
}
}.bind(this));
GameLib.Event.Emit(
GameLib.Event.BUILD_GUI,
null
)
}
};
GameLib.System.Input.prototype.onKeyUp = function(event) {
GameLib.Event.Emit(
GameLib.Event.KEY_UP,
{
code : event.code
}
);
if (event.code === 'ControlLeft') {
this.controlLeft = false;
}
};
GameLib.System.Input.prototype.onMouseDown = function(renderer, controls) {
return function(event) {
if (event.button === 2) {
if (this.controlLeft) {
return;
}
renderer.mouse.x = (event.offsetX / renderer.instance.domElement.width) * 2 - 1;
renderer.mouse.y = -(event.offsetY / renderer.instance.domElement.height) * 2 + 1;
var scenes = renderer.scenes;
var intersects = scenes.reduce(
function(result, scene) {
controls.raycaster.instance.setFromCamera(
renderer.mouse,
renderer.camera.instance
);
intersects = controls.raycaster.getIntersectedObjects(scene.meshes);
intersects.map(function(intersect){
result.push(intersect);
});
return result;
}.bind(this),
[]
);
intersects.sort(
function(a, b) {
if (a.distance < b.distance) {
return -1;
}
if (a.distance > b.distance) {
return 1;
}
return 0;
}
);
var meshes = intersects.map(function(intersect){
return intersect.mesh;
});
var mesh = meshes[0];
if (mesh) {
/**
* Prevent default action (like context menu or whatever)
*/
event.preventDefault();
/**
* Prevent other event listeners for 'mousedown' from executing their actions
*/
event.stopImmediatePropagation();
if (mesh.selected) {
this.deSelectMesh(mesh);
} else {
this.selectMesh(mesh);
}
/**
* Notify our GUI system to build a GUI
*/
GameLib.Event.Emit(
GameLib.Event.BUILD_GUI,
null
)
}
}
}.bind(this);
};
/**
*
* @param event
*/
GameLib.System.Input.prototype.onMouseMove = function(event) {
};
/**
* Update the camera position etc. after mouse up
* @param __camera
* @param __controls
* @returns {Function}
*/
GameLib.System.Input.prototype.onMouseUp = function(__camera, __controls) {
return function(event) {
__camera.position.x = __camera.instance.position.x;
__camera.position.y = __camera.instance.position.y;
__camera.position.z = __camera.instance.position.z;
__camera.quaternion.x = __camera.instance.quaternion.x;
__camera.quaternion.y = __camera.instance.quaternion.y;
__camera.quaternion.z = __camera.instance.quaternion.z;
__camera.quaternion.w = __camera.instance.quaternion.w;
__camera.lookAt.x = __controls.instance.center.x;
__camera.lookAt.y = __controls.instance.center.y;
__camera.lookAt.z = __controls.instance.center.z;
__camera.lookAt.instance.copy(__controls.instance.center);
};
};
/**
* Update our camera position after moving the mouse wheel
* @param __camera
* @returns {Function}
*/
GameLib.System.Input.prototype.onMouseWheel = function(__camera) {
return function(event) {
__camera.position.x = __camera.instance.position.x;
__camera.position.y = __camera.instance.position.y;
__camera.position.z = __camera.instance.position.z;
}
};
GameLib.System.Input.prototype.selectMesh = function(mesh) {
2017-06-19 15:54:02 +02:00
/**
2017-08-24 22:20:40 +02:00
* If mesh is already selected, do nothing
2017-06-19 15:54:02 +02:00
*/
2017-08-24 22:20:40 +02:00
if (mesh.selected === true) {
return;
}
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
/**
* Notify our component as being 'selected'
* @type {boolean}
*/
mesh.selected = true;
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
mesh.createHelper();
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
GameLib.Event.Emit(
GameLib.Event.MESH_SELECTED,
{
mesh : mesh
}
);
};
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
GameLib.System.Input.prototype.deSelectMesh = function(mesh) {
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
mesh.selected = false;
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
mesh.removeHelper();
2017-06-19 15:54:02 +02:00
2017-08-24 22:20:40 +02:00
GameLib.Event.Emit(
GameLib.Event.MESH_DESELECTED,
{
mesh : mesh
}
);
2017-06-19 15:54:02 +02:00
};
2017-08-24 22:20:40 +02:00
/**
*
*/
2017-06-19 15:54:02 +02:00
GameLib.System.Input.prototype.stop = function() {
GameLib.System.prototype.stop.call(this);
2017-09-27 21:44:25 +02:00
if (this.editorControls.length > 0) {
/**
* Now remove all input capabilities
*/
this.renderers.map(
2017-09-27 21:44:25 +02:00
function(renderer) {
2017-08-24 22:20:40 +02:00
2017-09-27 21:44:25 +02:00
renderer.domElement.instance.removeEventListener(
'mousedown',
renderer.mouseDown,
false
);
2017-06-19 15:54:02 +02:00
2017-09-27 21:44:25 +02:00
renderer.domElement.instance.removeEventListener(
'mousemove',
renderer.mouseMove,
false
);
2017-08-24 22:20:40 +02:00
2017-09-27 21:44:25 +02:00
renderer.domElement.instance.removeEventListener(
'keydown',
renderer.keyDown,
false
);
2017-08-24 22:20:40 +02:00
2017-09-27 21:44:25 +02:00
renderer.domElement.instance.removeEventListener(
'keyup',
renderer.keyUp,
false
);
2017-08-24 22:20:40 +02:00
2017-09-27 21:44:25 +02:00
if (renderer.controls && renderer.controls.instance) {
renderer.controls.instance.dispose();
} else {
console.warn('no third party controls to stop for renderer : ' + renderer.name);
}
2017-08-24 22:20:40 +02:00
2017-09-27 21:44:25 +02:00
renderer.domElement.instance.removeEventListener(
'mousewheel',
renderer.mouseWheel,
false
);
renderer.domElement.instance.removeEventListener(
'mouseup',
renderer.mouseUp,
false
);
}.bind(this)
);
}
if (this.touchControls.length > 0) {
this.touchControls.map(
function(touchControl) {
touchControl.domElement.instance.removeEventListener(
'touchstart',
this.touchStart,
false
);
touchControl.domElement.instance.removeEventListener(
'touchmove',
this.touchMove,
false
);
touchControl.domElement.instance.removeEventListener(
'touchend',
this.touchEnd,
false
);
touchControl.domElement.instance.removeEventListener(
'touchcancel',
this.touchCancel,
false
);
}.bind(this)
)
}
2017-08-24 22:20:40 +02:00
2017-09-29 06:09:47 +02:00
if (this.keyboardControls.length > 0) {
this.keyboardControls.map(
function(keyboardControl) {
keyboardControl.domElement.instance.removeEventListener(
'keydown',
this.keyboardKeyDown,
false
);
keyboardControl.domElement.instance.removeEventListener(
'keyup',
this.keyboardKeyUp,
false
);
}.bind(this)
)
}
2017-06-19 15:54:02 +02:00
};
2017-08-24 22:20:40 +02:00
//
// console.log('keypressed ' + event.code);
//
// if (event.code === 'KeyV') {
// //todo - change view
// }
//
// if (event.code == "KeyQ") {
//
// this.editor.allSelected = !this.editor.allSelected;
//
// this.editor.selectedObjects = [];
//
// if (this.editor.allSelected) {
// for (var property in this.editor.idToObject) {
// if (this.editor.idToObject.hasOwnProperty(property)) {
// this.editor.selectedObjects.push(
// new GameLib.D3.SelectedObject(
// this.graphics,
// this.editor.idToObject(property)
// )
// )
// }
// }
// }
//
// if (this.editor.onSelectionChanged) {
// this.editor.onSelectionChanged(this.editor);
// }
// }
//
// if (event.code == 'KeyG') {
// if (!this.meshMoveMode) {
// console.log('move mode');
// this.meshMoveMode = true;
// }
// }
//
// if (event.code == 'KeyX') {
// if (this.meshMoveMode) {
// console.log('move along x');
// this.meshMoveXMode = true;
// this.meshMoveYMode = false;
// this.meshMoveZMode = false;
// }
// }
//
// if (event.code == 'KeyY') {
// if (this.meshMoveMode) {
// console.log('move along y');
// this.meshMoveXMode = false;
// this.meshMoveYMode = true;
// this.meshMoveZMode = false;
// }
// }
//
// if (event.code == 'KeyZ') {
// if (this.meshMoveMode) {
// console.log('move along z');
// this.meshMoveXMode = false;
// this.meshMoveYMode = false;
// this.meshMoveZMode = true;
// }
// }
//
// if (event.code == 'Escape') {
// if (this.meshMoveMode) {
// this.meshMoveMode = false;
// console.log('TODO: implement restore positions');
// }
// }
//
// if (event.code == 'Enter') {
// if (this.meshMoveMode) {
// this.meshMoveMode = false;
// console.log('TODO: implement apply positions');
// }
// }
// };
// GameLib.D3.Input.Editor.prototype.onMouseDown = function(entity) {
//
// return function(event) {
//
// if (event.button === 2) {
// event.cancelBubble = true;
//
// event.preventDefault();
//
// if (event.stopPropagation) {
// event.stopPropagation();
// }
//
// var meshes = entity.queryComponents(GameLib.D3.Mesh);
//
// var intersects = this.raycaster.getIntersectedObjects(meshes);
//
// if (intersects.length > 0) {
//
// console.log('object(s) instersected');
//
// // var index = -1;
// //
// // for (var s = 0; s < this.editor.selectedObjects.length; s++) {
// // if (this.editor.selectedObjects[s].object == intersects[0]) {
// // index = s;
// // break;
// // }
// // }
// //
// // if (index == -1) {
// // /**
// // * The object is not selected, select it
// // */
// // this.selectObject(intersects[0]);
// //
// // } else {
// // /**
// // * De-select the objec
// // */
// // var delta = Date.now() - this.editor.selectedObjects[index].lastUpdate;
// // if (delta > this.selectDelayMs) {
// // this.unselectObject(intersects[0]);
// // }
// // }
// //
// // if (this.editor.onSelectionChanged) {
// // this.editor.onSelectionChanged(this.editor);
// // }
// }
//
// return false;
// }
// }
// };
// /**
// * Mouse click events
// * @param event
// * @returns {boolean}
// */
// GameLib.D3.Input.Editor.prototype.onMouseDown = function(event) {
//
// if (event.button === 2) {
//
//
//
//
//
// }
//
// if (event.button == 0) {
// if (this.meshMoveMode) {
// this.meshMoveMode = false;
// this.meshMoveXMode = false;
// this.meshMoveYMode = false;
// this.meshMoveZMode = false;
// }
// }
// };
// /**
// * Mouse move events
// * @param event
// */
// GameLib.D3.Input.Editor.prototype.onMouseMove = function(event) {
//
// // var clientX = event.clientX - this.widthOffset;
// // this.mouse.x = ((clientX / (window.innerWidth - this.widthOffset))) * 2 - 1;
// // this.mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
//
// this.mouse.x = event.clientX;
// this.mouse.y = event.clientY;
//
// console.log("mouse (" + this.mouse.x + ", " + this.mouse.y + ")");
//
// this.raycaster.instance.setFromCamera(
// this.mouse,
// this.camera.instance
// );
//
// if (this.meshMoveMode) {
//
// var units = event.movementY;
//
// if (this.meshMoveXMode) {
// this.moveSelectedObjects('x', units);
// }
//
// if (this.meshMoveYMode) {
// this.moveSelectedObjects('y', units);
// }
//
// if (this.meshMoveZMode) {
// this.moveSelectedObjects('z', units);
// }
// }
// };
// /**
// * Moves selected objects along an axis
// * @param alongAxis
// * @param units
// */
// GameLib.D3.Input.Editor.prototype.moveSelectedObjects = function(alongAxis, units) {
//
// for (var s = 0; s < this.editor.selectedObjects.length; s++) {
//
// var object = this.editor.selectedObjects[s].object;
//
// if (object.position) {
// if (alongAxis == 'x') {
// object.position.x += units;
// }
// if (alongAxis == 'y') {
// object.position.y += units;
// }
// if (alongAxis == 'z') {
// object.position.z += units;
// }
//
// if (object.updateInstance) {
// object.updateInstance();
// }
// }
// }
// };