Hello
Is there a way to add dynamically to an existing node shape with binding?
Example code ( svg does not refresh )
function addExtraPort(node) {
myDiagram.startTransaction(“addport”);
if (!(node instanceof go.Node)) return false;
var port = go.GraphObject.make(go.Shape, "Circle", {
portId: "x1",
alignment: new go.Spot(0.7, 0.7),
desiredSize: new go.Size(10, 10)
},
new go.Binding("geometryString", "geo", function(d, e) {
return "F M0 0 L100 0 Q150 50 100 100 L0 100 Q50 50 0 0z";
}));
node.add(port);
myDiagram.model.setDataProperty(node.data, "geo", "F M0 0 L100 0 Q150 50 100 100 L0 100 Q50 50 0 0z");
myDiagram.model.updateTargetBindings(node.data);
myDiagram.commitTransaction("addport");
}