MarkupCore - 是否可以禁用 ForgeViewer 中悬停标记的右键单击?

MarkupCore - Is it possible to disable rightClick on a hovered markup in ForgeViewer?

每当我将鼠标悬停在标记上并右键单击它时,它会将鼠标移动锁定在绘图上,这样就无法在不移动绘图的情况下移动鼠标。

是否可以禁用此行为?

根据您的具体情况,您可以尝试以下几种方法:

如果您在二维绘图的标记模式下尝试启用相机平移,您只需为标记工具“启用导航”即可:

viewer.toolController.getTool('markups.core').allowNavigation(true);

如果这对您的情况还不够,您还可以尝试修改 handleButtonDown 标记工具用来决定是否以及如何处理鼠标按钮按下事件的方法。目前该方法如下所示:

this.handleButtonDown = function(event, button) {
    if (this.allowNav || (this.is2d && (avp.isRightClick(event, this.viewer.navigation) || avp.isMiddleClick(event)))) {
        // If pan tool won't handle button down, then pass over the event
        if (this.panTool && this.panTool.handleButtonDown) {
            return this.panTool.handleButtonDown(event, button);
        } else return false;
    }
    return true; // Consume event
};

其中 avp 只是 Autodesk.Viewing.Private 命名空间的快捷方式。

viewer.toolController.getTool('markups.core').handleButtonDown = function (event, button) {
    // Return true when you want the measure tool to "capture" the event and process it somehow,
    // or false when you want to ignore the event and allow other tools on the stack to handle it
};