【问题标题】:how can i disable default menu in gojs我如何禁用 gojs 中的默认菜单
【发布时间】:2026-01-03 15:25:02
【问题描述】:

我是gojs 的新手, 当我在页面中我的手机屏幕 (#myDiagram div) 时,会显示一些默认菜单,但我不想要它。

我尝试通过设置"toolManager.isEnable":false 来禁用它,但没有成功

 myDiagram =
        $(go.Diagram, "myDiagramDiv",
          {
            initialAutoScale: go.Diagram.Uniform,
            initialContentAlignment: go.Spot.Center,
            allowDrop: false,
            allowMove: false,
            "toolManager.isEnable":false,
            nodeSelectionAdornmentTemplate:
              $(go.Adornment, "Auto",
                { layerName: "Grid" }, 
                $(go.Placeholder)
              ),
            layout:  // use a custom layout, defined below
              $(GenogramLayout, { direction: 90, layerSpacing: 30, columnSpacing: 10 })
          });

如何禁用它?

这是按下后显示的内容

【问题讨论】:

    标签: menu gojs


    【解决方案1】:

    https://gojs.net/latest/intro/contextmenus.html#DefaultContextMenuForTouchEnabledDevices 中所述,您只需将 ContextMenuTool 属性设置为 null。例如,在图表的初始化过程中:

    $(go.Diagram, . . .,
      {
        "contextMenuTool.defaultTouchContextMenu": null
      })
    

    【讨论】:

      最近更新 更多