文本在gojs树图中与箭头重叠

时间:2018-07-17 11:01:48

标签: javascript html gojs

我目前正在使用gojs创建树形结构图

我在布置节点时遇到问题,文本与箭头重叠

建议/帮助深表感谢

myDiagram.nodeTemplate =
$(go.Node, "Auto", {
    movable: true
  },
  $(go.Panel, "Vertical",

    $(go.Panel, "Auto", {
        background: "white"
      }, {
        portId: ""
      },
      $(go.Shape, "Circle", {
          strokeWidth: 4,
          margin: go.Margin.parse("10 5 10 5"),
          height: 75,
          width: 75,
          cursor: "pointer"
        },
        new go.Binding("fill", "color"), new go.Binding("stroke", "strokeColor")
      ),

      $(go.Panel, "Vertical",
        $(go.Picture, {
          source: "https://msdnshared.blob.core.windows.net/media/2017/05/icon.png",
          background: "white",
          width: 25,
          height: 25
        })
      )
    ),

    $(go.Panel, "Auto",
      $(go.TextBlock, {
          margin: 5,
          font: '14px "Open Sans", sans-serif'
        },
        new go.Binding("text", "name"))
    )
  )

);

我的工作fiddle is available

1 个答案:

答案 0 :(得分:1)

删除作业:

{
  portId: ""
},

https://gojs.net/latest/intro/ports.html#SinglePorts处阅读讨论,不同的是,除了让 Panel 按住圆圈 Shape Picture 端口,则需要默认的行为,其中整个 Node 都充当端口。