From 27726c29aed58eb277f84b1230d3c57ab66c9ae1 Mon Sep 17 00:00:00 2001 From: rakadu1 Date: Thu, 18 Sep 2025 18:04:38 +0530 Subject: [PATCH] C button temporarily clears everything on screen. --- steps/src/main.js | 8 ++++++++ steps/src/p5/radarSketch.js | 13 +++++++++---- steps/src/state.js | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/steps/src/main.js b/steps/src/main.js index 8ea6ff0..ccc8c04 100644 --- a/steps/src/main.js +++ b/steps/src/main.js @@ -811,6 +811,7 @@ document.addEventListener("keydown", (event) => { "s", "m", "q", + "c" ]; if (!appState.vizData || !recognizedKeys.includes(key)) { @@ -871,6 +872,13 @@ document.addEventListener("keydown", (event) => { if (key === "r") { resetVisualization(); } + if (key === "c") { + appState.isRawOnlyMode = !appState.isRawOnlyMode; + if(appState.p5_instance) { + appState.p5_instance.redraw(); + } + } + if (key === "p") { togglePredictedPos.click(); appState.p5_instance.redraw(); diff --git a/steps/src/p5/radarSketch.js b/steps/src/p5/radarSketch.js index bd1c2fc..1d1340d 100644 --- a/steps/src/p5/radarSketch.js +++ b/steps/src/p5/radarSketch.js @@ -139,7 +139,9 @@ export const radarSketch = function (p) { // Get current frame data const frameData = appState.vizData.radarFrames[appState.currentFrame]; if (frameData) { - drawRegionsOfInterest(p, frameData, plotScales); + drawPointCloud(p, frameData.pointCloud, plotScales); + if (!appState.isRawOnlyMode) { + drawRegionsOfInterest(p, frameData, plotScales); drawTrackMarkers(p, plotScales); // Draw object trajectories and markers if enabled @@ -197,18 +199,21 @@ export const radarSketch = function (p) { } } } - // Draw the point cloud for the current frame - drawPointCloud(p, frameData.pointCloud, plotScales); + // Draw cluster centroids if enabled if (toggleClusterColor.checked) { drawClusterCentroids(p, frameData.clusters, plotScales); } + + + } + } p.pop(); // 4. Draw the new legend buffer onto the main canvas // This is placed at the bottom-right corner. - if (toggleTracks.checked) { + if (toggleTracks.checked && !appState.isRawOnlyMode) { p.image( trackLegendBuffer, p.width - trackLegendBuffer.width - 10, diff --git a/steps/src/state.js b/steps/src/state.js index 00619b2..92016db 100644 --- a/steps/src/state.js +++ b/steps/src/state.js @@ -1,4 +1,6 @@ export const appState = { + isRawOnlyMode: false, // <-- ADD THIS LINE + // Stores the parsed visualization data (radar frames, tracks, etc.) vizData: null, zoomSketchInstance: null, // Add this line