tidy inspect.js

This commit is contained in:
Triplelexx 2018-03-16 20:13:02 +00:00
parent 59a088f226
commit 563be9ab91

View file

@ -83,7 +83,6 @@ var rotatingTowardsTarget = false;
var targetCamOrientation; var targetCamOrientation;
var oldPosition, oldOrientation; var oldPosition, oldOrientation;
function orientationOf(vector) { function orientationOf(vector) {
var direction, var direction,
yaw, yaw,
@ -95,7 +94,6 @@ function orientationOf(vector) {
return Quat.multiply(yaw, pitch); return Quat.multiply(yaw, pitch);
} }
function handleRadialMode(dx, dy) { function handleRadialMode(dx, dy) {
azimuth += dx / AZIMUTH_RATE; azimuth += dx / AZIMUTH_RATE;
radius += radius * dy * RADIUS_RATE; radius += radius * dy * RADIUS_RATE;
@ -133,7 +131,6 @@ function handleOrbitMode(dx, dy) {
Camera.setOrientation(orientationOf(vector)); Camera.setOrientation(orientationOf(vector));
} }
function handlePanMode(dx, dy) { function handlePanMode(dx, dy) {
var up = Quat.getUp(Camera.getOrientation()); var up = Quat.getUp(Camera.getOrientation());
var right = Quat.getRight(Camera.getOrientation()); var right = Quat.getRight(Camera.getOrientation());
@ -254,8 +251,6 @@ function keyReleaseEvent(event) {
} }
} }
function mousePressEvent(event) { function mousePressEvent(event) {
if (alt && !isActive) { if (alt && !isActive) {
mouseLastX = event.x; mouseLastX = event.x;
@ -267,20 +262,17 @@ function mousePressEvent(event) {
position = Camera.getPosition(); position = Camera.getPosition();
var avatarTarget = MyAvatar.getTargetAvatarPosition();
var distance = -1; var distance = -1;
var string; var string = "";
if (modelIntersection.intersects && modelIntersection.accurate) { if (modelIntersection.intersects && modelIntersection.accurate) {
distance = modelIntersection.distance; distance = modelIntersection.distance;
center = modelIntersection.intersection; center = modelIntersection.intersection;
string = "Inspecting model"; string = "Inspecting model";
//We've selected our target, now orbit towards it automatically // We've selected our target, now orbit towards it automatically
rotatingTowardsTarget = true; rotatingTowardsTarget = true;
//calculate our target cam rotation // calculate our target cam rotation
Script.setTimeout(function() { Script.setTimeout(function () {
rotatingTowardsTarget = false; rotatingTowardsTarget = false;
}, LOOK_AT_TIME); }, LOOK_AT_TIME);
@ -313,7 +305,6 @@ function mouseMoveEvent(event) {
if (mode == panningMode) { if (mode == panningMode) {
handlePanMode(event.x - mouseLastX, event.y - mouseLastY); handlePanMode(event.x - mouseLastX, event.y - mouseLastY);
} }
} }
mouseLastX = event.x; mouseLastX = event.x;
mouseLastY = event.y; mouseLastY = event.y;
@ -327,7 +318,7 @@ function update() {
} }
function rotateTowardsTarget() { function rotateTowardsTarget() {
var newOrientation = Quat.mix(Camera.getOrientation(), targetCamOrientation, .1); var newOrientation = Quat.mix(Camera.getOrientation(), targetCamOrientation, 0.1);
Camera.setOrientation(newOrientation); Camera.setOrientation(newOrientation);
} }