Browse Source

C button temporarily clears everything on screen.

refactor/modularize
RUSHIL AMBARISH KADU 8 months ago
parent
commit
27726c29ae
  1. 8
      steps/src/main.js
  2. 11
      steps/src/p5/radarSketch.js
  3. 2
      steps/src/state.js

8
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();

11
steps/src/p5/radarSketch.js

@ -139,6 +139,8 @@ export const radarSketch = function (p) {
// Get current frame data
const frameData = appState.vizData.radarFrames[appState.currentFrame];
if (frameData) {
drawPointCloud(p, frameData.pointCloud, plotScales);
if (!appState.isRawOnlyMode) {
drawRegionsOfInterest(p, frameData, plotScales);
drawTrackMarkers(p, plotScales);
@ -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,

2
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

Loading…
Cancel
Save