Mobile support

This commit is contained in:
Thomas FORGIONE 2015-04-08 15:54:57 +02:00
parent 5eec180fd5
commit bfa7e277d3
2 changed files with 4 additions and 0 deletions

View File

@ -41,8 +41,11 @@ var PointerCamera = function() {
document.addEventListener('keydown', onKeyDown, false); document.addEventListener('keydown', onKeyDown, false);
document.addEventListener('keyup', onKeyUp, false); document.addEventListener('keyup', onKeyUp, false);
document.addEventListener('mousedown', onMouseDown, false); document.addEventListener('mousedown', onMouseDown, false);
document.addEventListener('touchstart', onMouseDown, false);
document.addEventListener('mousemove', onMouseMove, false); document.addEventListener('mousemove', onMouseMove, false);
document.addEventListener('touchmove', onMouseMove, false);
document.addEventListener('mouseup', onMouseUp, false); document.addEventListener('mouseup', onMouseUp, false);
document.addEventListener('touchend', onMouseUp, false);
} }
PointerCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); PointerCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
PointerCamera.prototype.constructor = PointerCamera; PointerCamera.prototype.constructor = PointerCamera;

View File

@ -87,6 +87,7 @@ function init() {
window.addEventListener('resize', onWindowResize, false); window.addEventListener('resize', onWindowResize, false);
container.addEventListener('mousedown', click, false); container.addEventListener('mousedown', click, false);
container.addEventListener('touchstart', click, false);
// Load the scene // Load the scene
loadScene(); loadScene();