Mobile support
This commit is contained in:
parent
5eec180fd5
commit
bfa7e277d3
|
@ -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;
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue