如何调整gojs按钮的大小
How to resize gojs button
我在 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) }
)
)
);
}
谢谢!
而不是设置按钮的 width 和 height,你可以尝试设置它的 scale.
我在 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) }
)
)
);
}
而不是设置按钮的 width 和 height,你可以尝试设置它的 scale.