I am using following template -
myDiagram.nodeTemplate = $$(go.Node, “Spot”,
{
locationObjectName: “SHAPE”, locationSpot: go.Spot.Center, zOrder: 0,
resizable: true, resizeObjectName: “PANEL”,
selectionAdorned: true
},
new go.Binding(“location”, “loc”, go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding(“zOrder”, “zOrder”),
$$(go.Panel, “Auto”,
{
name: “PANEL”,
},
new go.Binding(“desiredSize”, “size”, go.Size.parse).makeTwoWay(go.Size.stringify),
$$(go.Panel, “Spot”,
$$(go.Shape,
{
name: “SHAPE”, figure : “triangle”,
fill: “red”, stroke: “black”,strokeWidth:3,
portId: “”,
fromLinkable: true, toLinkable: true,
stretch: go.GraphObject.Fill,
}
),
$$(go.TextBlock, // the center text
{
alignment: go.Spot.TopRight, cursor: “move”, margin:-10, text :“Rectangle”,
overflow: go.TextBlock.OverflowEllipsis, maxLines: 1,
editable: true, isMultiline: false,
stroke : “black”
})
)
) // end Auto Panel
); // end go.Node, which is a Spot Panel with bound itemArray
With this template I am not able to move the text away from shape -
When margin is given negative, it becomes invisible or partially visible. I think it is not the correct one I am using.
How to move text away from shape ?
The other problem I am facing are -
- When diagram is loaded - it display the text properly (with margin = 0 ) but as i start resizing the shape becomes too large automatically.
- How the resizing handles or adortment can be shown only for shape ? Currently due to alignment property it shows selection handle for complete shape along with text area.