only do depth reticle depth check when the reticle is visible

This commit is contained in:
Brad Hefta-Gaub 2016-03-31 15:58:37 -07:00
parent 74633ca8c8
commit bbca1ba6db

View file

@ -112,7 +112,7 @@ function autoHideReticle() {
function checkReticleDepth() {
var now = Date.now();
var timeSinceLastDepthCheck = now - lastDepthCheckTime;
if (timeSinceLastDepthCheck > TIME_BETWEEN_DEPTH_CHECKS) {
if (timeSinceLastDepthCheck > TIME_BETWEEN_DEPTH_CHECKS && Reticle.visible) {
var newDesiredDepth = desiredDepth;
lastDepthCheckTime = now;
var reticlePosition = Reticle.position;
@ -160,7 +160,6 @@ function moveToDesiredDepth() {
} else {
newDepth = Reticle.depth + distanceToAdjustThisCycle;
}
Reticle.setDepth(newDepth);
}
}