ros viewer now hijakcs scroll and right click to prevent normal behaviour

master
Jake Wilkinson 2025-11-22 23:40:28 +08:00
parent 4b6a275696
commit 58eedd06a3
1 changed files with 16 additions and 2 deletions

View File

@ -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 rightclick menu
e.stopPropagation(); // keeps it from bubbling up
// Your custom rightclick 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