mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 05:52:31 +02:00
Merge pull request #7531 from ZappoMan/optimizeDepthReticle
only do depth reticle depth check when the reticle is visible
This commit is contained in:
commit
cd548744f6
1 changed files with 1 additions and 2 deletions
|
@ -112,7 +112,7 @@ function autoHideReticle() {
|
||||||
function checkReticleDepth() {
|
function checkReticleDepth() {
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var timeSinceLastDepthCheck = now - lastDepthCheckTime;
|
var timeSinceLastDepthCheck = now - lastDepthCheckTime;
|
||||||
if (timeSinceLastDepthCheck > TIME_BETWEEN_DEPTH_CHECKS) {
|
if (timeSinceLastDepthCheck > TIME_BETWEEN_DEPTH_CHECKS && Reticle.visible) {
|
||||||
var newDesiredDepth = desiredDepth;
|
var newDesiredDepth = desiredDepth;
|
||||||
lastDepthCheckTime = now;
|
lastDepthCheckTime = now;
|
||||||
var reticlePosition = Reticle.position;
|
var reticlePosition = Reticle.position;
|
||||||
|
@ -160,7 +160,6 @@ function moveToDesiredDepth() {
|
||||||
} else {
|
} else {
|
||||||
newDepth = Reticle.depth + distanceToAdjustThisCycle;
|
newDepth = Reticle.depth + distanceToAdjustThisCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reticle.setDepth(newDepth);
|
Reticle.setDepth(newDepth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue