Browse Source

Fix inertia bugs (including issue #35).

tags/2.1.0
Matthew Petroff 10 years ago
parent
commit
e7908926a9
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      src/js/pannellum.js

+ 17
- 0
src/js/pannellum.js View File

@@ -363,6 +363,9 @@ function onDocumentMouseMove(event) {


function onDocumentMouseUp() { function onDocumentMouseUp() {
isUserInteracting = false; isUserInteracting = false;
if (Date.now() - latestInteraction > 15) {
pitchSpeed = yawSpeed = 0;
}
document.getElementById('page').className = 'grab'; document.getElementById('page').className = 'grab';
} }


@@ -424,6 +427,9 @@ function onDocumentTouchMove(event) {


function onDocumentTouchEnd() { function onDocumentTouchEnd() {
isUserInteracting = false; isUserInteracting = false;
if (Date.now() - latestInteraction > 15) {
pitchSpeed = yawSpeed = 0;
}
onPointerDownPointerDist = -1; onPointerDownPointerDist = -1;
} }


@@ -665,6 +671,17 @@ function keyRepeat() {
pitchSpeed = Math.min(maxSpeed, Math.max(pitchSpeed, -maxSpeed)); pitchSpeed = Math.min(maxSpeed, Math.max(pitchSpeed, -maxSpeed));
zoomSpeed = Math.min(maxSpeed, Math.max(zoomSpeed, -maxSpeed)); zoomSpeed = Math.min(maxSpeed, Math.max(zoomSpeed, -maxSpeed));
} }
// Stop movement if opposite controls are pressed
if (keysDown[0] && keysDown[0]) {
zoomSpeed = 0;
}
if ((keysDown[2] || keysDown[6]) && (keysDown[3] || keysDown[7])) {
pitchSpeed = 0;
}
if ((keysDown[4] || keysDown[8]) && (keysDown[5] || keysDown[9])) {
yawSpeed = 0;
}
} }


function onDocumentResize() { function onDocumentResize() {


Loading…
Cancel
Save