diff --git a/ros_robot_visualiser/ViewerOverlay.js b/ros_robot_visualiser/ViewerOverlay.js index 6ff86dd..476325e 100644 --- a/ros_robot_visualiser/ViewerOverlay.js +++ b/ros_robot_visualiser/ViewerOverlay.js @@ -11,6 +11,20 @@ export class ViewerOverlay { this.overlayCanvas = document.getElementById('overlay-canvas'); + this.overlayCanvas.addEventListener("wheel", (e) => { + e.preventDefault(); // stops page scroll/zoom + // your zoom logic here + }, { passive: false }); // passive:false is required to call preventDefault + // Disable browser context menu on canvas + this.overlayCanvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); // stops the default right‑click menu + e.stopPropagation(); // keeps it from bubbling up + + // Your custom right‑click logic here + // e.clientX / e.clientY give you the mouse position + //this.handleRightClick(e); + }); + this.overlayCtx = this.overlayCanvas.getContext('2d'); this.uiElements = []; // for motor list items if you wrap them in UIElements @@ -192,9 +206,9 @@ export class ViewerOverlay { openMotorConfig(jointName, motorName) { - + const motor = this.robot.joints[jointName]; - + // Remove any existing config panel this.panels = this.panels.filter(p => !p.title?.startsWith("Config:"));