|
@@ -23,7 +23,6 @@
|
|
|
|
|
|
var SCREEN_WIDTH = window.innerWidth;
|
|
|
var SCREEN_HEIGHT = window.innerHeight;
|
|
|
- var AMOUNT = 100;
|
|
|
|
|
|
var container;
|
|
|
var stats;
|
|
@@ -59,7 +58,7 @@
|
|
|
info.innerHTML = 'Drag to spin the cube';
|
|
|
container.appendChild(info);
|
|
|
|
|
|
- camera = new Camera(0, 150, 300);
|
|
|
+ camera = new Camera(0, 150, 400);
|
|
|
camera.focus = 300;
|
|
|
camera.target.y = 150;
|
|
|
camera.updateMatrix();
|
|
@@ -95,12 +94,15 @@
|
|
|
|
|
|
document.addEventListener('mousedown', onDocumentMouseDown, false);
|
|
|
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
|
|
+ document.addEventListener('touchmove', onDocumentTouchMove, false);
|
|
|
}
|
|
|
|
|
|
//
|
|
|
|
|
|
function onDocumentMouseDown( event )
|
|
|
{
|
|
|
+ event.preventDefault();
|
|
|
+
|
|
|
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
|
|
document.addEventListener('mouseup', onDocumentMouseUp, false);
|
|
|
|
|
@@ -123,15 +125,12 @@
|
|
|
|
|
|
function onDocumentTouchStart( event )
|
|
|
{
|
|
|
- if(event.touches.length > 1)
|
|
|
+ if(event.touches.length == 1)
|
|
|
{
|
|
|
event.preventDefault();
|
|
|
|
|
|
mouseXOnMouseDown = event.touches[0].pageX - windowHalfX;
|
|
|
targetRotationOnMouseDown = targetRotation;
|
|
|
-
|
|
|
- document.addEventListener('touchmove', onDocumentTouchMove, false);
|
|
|
- document.addEventListener('touchend', onDocumentTouchEnd, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -142,22 +141,10 @@
|
|
|
event.preventDefault();
|
|
|
|
|
|
mouseX = event.touches[0].pageX - windowHalfX;
|
|
|
-
|
|
|
targetRotation = targetRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.05;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function onDocumentTouchEnd( event )
|
|
|
- {
|
|
|
- if(event.touches.length == 0)
|
|
|
- {
|
|
|
- event.preventDefault();
|
|
|
-
|
|
|
- document.removeEventListener('touchmove', onDocumentTouchMove, false);
|
|
|
- document.removeEventListener('touchend', onDocumentTouchEnd, false);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//
|
|
|
|
|
|
function loop()
|