Nodes are not changing position after setting its loc property

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.

It’s probably easiest to just set imageNode.location. If there’s a TwoWay Binding on the Node.location, the model data will be updated at the same time.

It’s also unnecessary to start a transaction, since the TextBlock.textEdited event handler is called within the transaction conducted by the TextEditingTool.

This too didn’t work. Any other option

Setting Node.location will definitely move the node. Perhaps a Layout is moving it back for some reason? I’m just guessing, since I have no idea of what is happening nor exactly what you want to happen.

Actually I was changing location in the text edited event based on the height of the edited textblock. In the text edited event the textblocks actual bounds was not changed. That’s why the change is not happening. In which event we will get textblocks actual bounds after editing

Yes, that’s right – the Node holding the TextBlock may need to be re-laid-out again. And that might cause the Layout to be invalidated and then performed again, causing nodes to be moved.