From bfa7e277d3b585da6933fa8b573b3d045433ea66 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 8 Apr 2015 15:54:57 +0200 Subject: [PATCH] Mobile support --- js/PointerCamera.js | 3 +++ scene/js/main.js | 1 + 2 files changed, 4 insertions(+) diff --git a/js/PointerCamera.js b/js/PointerCamera.js index abebd59..53231c9 100644 --- a/js/PointerCamera.js +++ b/js/PointerCamera.js @@ -41,8 +41,11 @@ var PointerCamera = function() { document.addEventListener('keydown', onKeyDown, false); document.addEventListener('keyup', onKeyUp, false); document.addEventListener('mousedown', onMouseDown, false); + document.addEventListener('touchstart', onMouseDown, false); document.addEventListener('mousemove', onMouseMove, false); + document.addEventListener('touchmove', onMouseMove, false); document.addEventListener('mouseup', onMouseUp, false); + document.addEventListener('touchend', onMouseUp, false); } PointerCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); PointerCamera.prototype.constructor = PointerCamera; diff --git a/scene/js/main.js b/scene/js/main.js index 333555a..749f31d 100644 --- a/scene/js/main.js +++ b/scene/js/main.js @@ -87,6 +87,7 @@ function init() { window.addEventListener('resize', onWindowResize, false); container.addEventListener('mousedown', click, false); + container.addEventListener('touchstart', click, false); // Load the scene loadScene();