Hi,
I have a scenario where I should be able to Duplicate a component on my diagram. I achieved it by using the command handler’s copySelection and pasteSelection as shown below:
duplicateComponent(compInstance, pt, e) {
let refDiagram = this.diagram;
refDiagram.startTransaction('duplicate');
refDiagram.commandHandler.copySelection();
const point = new go.Point(e['Ir']['offsetX'] + 20, e['Ir']['offsetY'] + 20);
refDiagram.commandHandler.pasteSelection(point);
refDiagram.commitTransaction('duplicate');
}
In this case, If i have a node called ‘ExampleNode1’ my duplicate node is also called ‘ExampleNode1’.
But, I want the Duplicate node to have the name ‘ExampleNode1-Copy1’.
How can i achieve this?