Copy paste of node

when i copy and paste a node, the new node is pasted on the copied node, is there any way to make the node to paste it away from the copied node?

Look at how the DrawCommandHandler overrides CommandHandler.copyToClipboard and CommandHandler.pasteFromClipboard in http://gojs.net/latest/extensions/DrawCommandHandler.js.

Hi,

This is how my code is:

export function getDiagram(goObj,refElement){

let diagram = goObj (go.Diagram,refElement,{


“commandHandler.pasteFromClipboard”: function() {
var currentOffset = go.CommandHandler.prototype.pasteFromClipboard.call(this);
var newOffset = new go.Point(20, 20);
this.diagram.moveParts(currentOffset, newOffset);
},


}

I could paste the copied node at offset (20,20) but only for one time. The clipboard is still having the old copied node and when I am pasting multiple times I get the node pasted in same place everytime. Please help me with this. I need to update the clipboard with pasted part or I need to increment the offset everytime it gets pasted by (20,20). Could u please give me a piece of advice.

Why don’t you just use or copy the code from http://gojs.net/latest/extensions/DrawCommandHandler.js ? Doesn’t that code do what you want? And the offset is even parameterized as the DrawCommandHandler.pasteOffset property.