|
|
@ -75,8 +75,14 @@ export const radarSketch = function (p) { |
|
|
canvasContainer.offsetHeight |
|
|
canvasContainer.offsetHeight |
|
|
); |
|
|
); |
|
|
canvas.parent("canvas-container"); |
|
|
canvas.parent("canvas-container"); |
|
|
// --- START: ADD MOUSE WHEEL LISTENER HERE ---
|
|
|
|
|
|
canvas.mouseWheel((event) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- START: Manual Mouse Wheel Listener for Passive Option ---
|
|
|
|
|
|
// We attach the listener manually to the canvas element to set the `passive` flag to `false`.
|
|
|
|
|
|
// This is necessary to allow `event.preventDefault()` and signals to the browser that
|
|
|
|
|
|
// we are intentionally handling the scroll behavior, resolving the console warning.
|
|
|
|
|
|
canvas.elt.addEventListener( |
|
|
|
|
|
"wheel", |
|
|
|
|
|
(event) => { |
|
|
// Only run this logic if the close-up mode is active
|
|
|
// Only run this logic if the close-up mode is active
|
|
|
if (appState.isCloseUpMode) { |
|
|
if (appState.isCloseUpMode) { |
|
|
event.preventDefault(); // Prevent the page from scrolling
|
|
|
event.preventDefault(); // Prevent the page from scrolling
|
|
|
@ -95,9 +101,6 @@ export const radarSketch = function (p) { |
|
|
appState.zoomSketchInstance && |
|
|
appState.zoomSketchInstance && |
|
|
appState.zoomSketchInstance.updateAndDraw |
|
|
appState.zoomSketchInstance.updateAndDraw |
|
|
) { |
|
|
) { |
|
|
// We just need to trigger an update; the zoom sketch will read the new
|
|
|
|
|
|
// appState.zoomFactor when it redraws.
|
|
|
|
|
|
// We find the current hovered items again to pass them.
|
|
|
|
|
|
const hoveredItems = handleCloseUpDisplay(p, plotScales); |
|
|
const hoveredItems = handleCloseUpDisplay(p, plotScales); |
|
|
appState.zoomSketchInstance.updateAndDraw( |
|
|
appState.zoomSketchInstance.updateAndDraw( |
|
|
p.mouseX, |
|
|
p.mouseX, |
|
|
@ -107,8 +110,10 @@ export const radarSketch = function (p) { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
// --- END: ADD MOUSE WHEEL LISTENER HERE ---
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
{ passive: false } |
|
|
|
|
|
); |
|
|
|
|
|
// --- END: Manual Mouse Wheel Listener ---
|
|
|
|
|
|
|
|
|
// Initialize graphics buffers
|
|
|
// Initialize graphics buffers
|
|
|
staticBackgroundBuffer = p.createGraphics(p.width, p.height); |
|
|
staticBackgroundBuffer = p.createGraphics(p.width, p.height); |
|
|
|