We are having an angular application and we are using diagram as directive.
In the diagram we have two templates
diagram.nodeTemplateMap.add(“texteditor”,
GO(go.Node, “Spot”,
new go.Binding(“location”, “loc”, go.Point.parse).makeTwoWay(go.Point.stringify),
GO(go.TextBlock,
{
margin : 5,
maxSize: new go.Size(280, NaN),
width: 280,
textAlign: ‘left’,
name:‘ParentText’,
alignment: go.Spot.Bottom,
editable: true,
isMultiline: true
},
new go.Binding("text").makeTwoWay(),
new go.Binding("font", "font").makeTwoWay(),
new go.Binding("stroke", "stroke").makeTwoWay(),
new go.Binding("background", "lightgreen"))
));
diagram.nodeTemplateMap.add("memoPicture",
GO(go.Node, "Spot",
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
GO(go.Panel, "Horizontal",
GO(go.Picture,
{
name: "Picture",
maxSize: new go.Size(250, 250),
margin: new go.Margin(5, 5, 5, 5),
},
new go.Binding("source", "source"))
)
)
);
In the text edited event of textblock, we are trying to move the picture node to some other position using
$scope.model.startTransaction(“ChangeLoc”);
$scope.model.setDataProperty(imageNode.data, ‘loc’, locPosition);
$scope.model.commitTransaction(“ChangeLoc”);
It is changing the position only in the second event. Can you please help us in this regard.