ros viewer now hijakcs scroll and right click to prevent normal behaviour
parent
4b6a275696
commit
58eedd06a3
|
|
@ -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:"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue