Browse Source

Shift key god mode added.

refactor/sync-centralize
RUSHIL AMBARISH KADU 6 months ago
parent
commit
0980398ed2
  1. 15
      steps/src/p5/radarSketch.js
  2. 4
      steps/src/sync.js

15
steps/src/p5/radarSketch.js

@ -84,8 +84,9 @@ export const radarSketch = function (p) {
"wheel",
(event) => {
// Only run this logic if the close-up mode is active
if (appState.isCloseUpMode) {
event.preventDefault(); // Prevent the page from scrolling
// Only allow zooming in god mode if the shift key is NOT pressed.
// When shift is pressed, the scroll event is used for timeline seeking.
if (appState.isCloseUpMode && !event.shiftKey) { event.preventDefault(); // Prevent the page from scrolling
const zoomSpeed = 0.5;
const direction = Math.sign(event.deltaY);
@ -260,6 +261,15 @@ export const radarSketch = function (p) {
const zoomPanel = document.getElementById("zoom-panel");
if (appState.isCloseUpMode) {
// --- START: Mouse Smoothing Logic ---
// --- START: Cursor Indicator Logic ---
// Change the cursor to provide a visual cue for the current scroll behavior.
if (p.keyIsDown(p.SHIFT)) {
p.cursor("ew-resize"); // Indicates horizontal seeking (timeline scrub)
} else {
p.cursor("crosshair"); // Default for zoom/inspection
}
// --- END: Cursor Indicator Logic ---
// On the first frame of zoom, snap the smoothed position to the real mouse position.
if (isFirstFrame) {
smoothedMouseX = p.mouseX;
@ -401,6 +411,7 @@ export const radarSketch = function (p) {
appState.zoomCountdownInterval = null;
}
// --- END: Cleanup Logic ---
p.cursor(p.AUTO); // Reset cursor when exiting god mode
zoomPanel.style.display = "none";
isFirstFrame = true; // Reset for the next time zoom mode is enabled
}

4
steps/src/sync.js

@ -253,8 +253,8 @@ let targetVideoTime = null; // NEW: State variable to track target time during s
function handleTimelineWheel(event) {
// If no data, or if close-up mode is active, do not seek.
// The wheel event is used for zooming in close-up mode.
if (!appState.vizData || appState.isCloseUpMode) {
// The wheel event is used for zooming in close-up mode, unless Shift is held.
if (!appState.vizData || (appState.isCloseUpMode && !event.shiftKey)) {
return;
}

Loading…
Cancel
Save