我正在嘗試使用 GoJS 庫繪制嵌套形狀?,F在我有一個矩形,里面只有一條線。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 )
GoJS嵌套形狀定位
慕勒3428872
2023-05-11 16:14:57