如何调整gojs按钮的大小

时间:2018-07-10 22:56:19

标签: javascript gojs

我在gojs中有一个使用组的图。每个组都有一个SubGraphExpanderButton。我想相对于图的其余部分(节点,链接等)增加SubGraphExpanderButton的大小。我怎么做?我在这里的文档中找不到它:https://gojs.net/latest/intro/buttons.html下面是我的GroupTemplate代码:

// define the group template
myDiagram.groupTemplate =
  $(go.Group, "Auto",
    {
        isSubGraphExpanded: false,  // initially, make all groups collapsed 
        layout: $(go.LayeredDigraphLayout,
                  { direction: 0, columnSpacing: 10 }),
        memberAdded: function(grp, part) {
            grp.visible = true;
        },
        memberRemoved: function(grp, part) {
            if (grp.memberParts.count <= 0) grp.visible = false;
        }
    },
    $(go.Shape, "Rectangle", new go.Binding("stroke", "color"),
      { fill: COLOR_WHITE, stroke: COLOR_GRAY, strokeWidth: BORDER_STROKE_WIDTH }
    ),
    $(go.Panel, "Vertical",
      { defaultAlignment: go.Spot.Left, margin: 15 },
      $(go.Panel, "Horizontal",
        { defaultAlignment: go.Spot.Top },
        $("SubGraphExpanderButton", { width:8, height:20 }),
        $(go.TextBlock,
          { font: "Bold 40px Sans-Serif", margin: 4, stroke: COLOR_BLACK },
          new go.Binding("text", "key"))
      ),
      $(go.Placeholder,
        { padding: new go.Margin(0, 10) }
      )
    )
  );

} Currently, the + button is too small 谢谢!

1 个答案:

答案 0 :(得分:1)

您可以尝试设置按钮的比例,而不是设置按钮的宽度高度