我正在尝试使用 GoJS 库绘制嵌套形状。现在我有一个矩形,里面只有一条线。Whole Object 是一个具有两种形状的面板,一个矩形和一条负线。此时就可以了,MinusLine 渲染在矩形的中心。
我想要实现的是根据我得到的某些条件从上到下定位/更改 MinusLine 的位置等,但是我不能以任何方式移动它。例如,将完全居中的黄色线移动到红色或棕色的位置
代码看起来像:
GO(go.Node, "Table",
{
layerName: "AfterForeground",
movable: false,
locationObjectName: "BODY",
locationSpot: go.Spot.parse("0.5 0 0 0 "),
selectionObjectName: "MAIN_SHAPE",
selectionObjectName: "MAIN_SHAPE",
},
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
GO(go.Panel,go.Panel.Position, "Auto", {
row: 1,
column: 1,
name: "BODY",
stretch: go.GraphObject.Fill
},
GO(go.Shape, "Rectangle", {
fill: wellColor,
name: "MAIN_SHAPE",
stroke: myColor,
strokeWidth: 0.4,
}, new go.Binding("fill", "wellColor"),
) , new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify)
,GO(go.Shape, "MinusLine", {}), // <-- Move this YELLOW line vertically somehere inside Rectangle
)
一只名叫tom的猫
相关分类