From 162de7c980b56d4c1ba9de884b3f7d6ea16239b1 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 1 Mar 2024 12:17:02 -0800 Subject: [PATCH] feat: change grid view distance --- .../lib/Dashboard/Visualization/Scene.svelte | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client/src/lib/Dashboard/Visualization/Scene.svelte b/client/src/lib/Dashboard/Visualization/Scene.svelte index af70e0e..be0ab7e 100644 --- a/client/src/lib/Dashboard/Visualization/Scene.svelte +++ b/client/src/lib/Dashboard/Visualization/Scene.svelte @@ -85,6 +85,20 @@ } } + let gridFadeDistance = 30 + + const fadeGridIn = (delta: number) => { + if (gridFadeDistance < 100) { + gridFadeDistance += delta * 40 + } + } + + const fadeGridOut = (delta: number) => { + if (gridFadeDistance > 30) { + gridFadeDistance -= delta * 40 + } + } + useTask(delta => { /* TODO: standardize a scale (meters : grid lengths) so we can have accurate positioning of sensor detected objects */ @@ -95,6 +109,12 @@ $telemetryReadonlyStore['chassis-x-speed'] * delta * SPEED_MULTIPLIER $mesh.rotation.y = $telemetryReadonlyStore.orientation * DEG2RAD + if ($cameraState.mode === 'orbit') { + fadeGridOut(delta) + } else { + fadeGridIn(delta) + } + // run the follow function follow(delta) }) @@ -126,7 +146,7 @@