From bbca1ba6db70772f4ff7105c652d201c506784fd Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 31 Mar 2016 15:58:37 -0700 Subject: [PATCH] only do depth reticle depth check when the reticle is visible --- examples/depthReticle.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/depthReticle.js b/examples/depthReticle.js index 52392b2466..90e5db0f1a 100644 --- a/examples/depthReticle.js +++ b/examples/depthReticle.js @@ -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); } }