我的工作是使逻辑电路使用盖茨和多路复用使用javascript和GoJS。我想获取一个特定的输入端口值,并在另一个函数中使用它
var multiplexarTemplate =
$(go.Node, "Spot", nodeStyle(),
$(go.Shape, "Rectangle", { width: 50, height: 80, margin: 4,
fill: "lightgray", stroke: "darkslategray", strokeWidth: 2
}),
$(go.Shape, "Rectangle", portStyle(true),
{ portId: "in1", alignment: new go.Spot(0, 0.2) }),
$(go.Shape, "Rectangle", portStyle(true),
{ portId: "in2", alignment: new go.Spot(0, 0.4) }),
$(go.Shape, "Rectangle", portStyle(true),
{ portId: "in3", alignment: new go.Spot(0, 0.6) }),
$(go.Shape, "Rectangle", portStyle(true),
{ portId: "in4", alignment: new go.Spot(0, 0.8) }),
$(go.Shape, "Rectangle", portStyle(true),
{ portId: "in5", alignment: new go.Spot(0.3, 1) }),
$(go.Shape, "Rectangle", portStyle(true),
{ portId: "in6", alignment: new go.Spot(0.65, 1) }),
$(go.Shape, "Rectangle", portStyle(false),
{ portId: "out", alignment: new go.Spot(1, 0.5) })
)在本例中,我想特别获取in1,并在另一个函数中使用它。以同样的方式,我也想获得in2,in3,in4,并在另一个函数中使用它,但我不能弄清楚如何做到这一点。
发布于 2019-06-08 01:11:07
使用Node.findPort:https://gojs.net/latest/api/symbols/Node.html#findPort
var in2 = someNode.findPort('in2');https://stackoverflow.com/questions/56498155
复制相似问题