How can i get the link current position (not points) in order to use:
move(new go.point(currentPosition + offset))?
Thanks
How can i get the link current position (not points) in order to use:
move(new go.point(currentPosition + offset))?
Thanks
Just get its position property.
But both are Point(NaN,NaN).
Should i bind it to something?
Thanks
Ah, you must be looking at a Link object before it has had a chance to be measured and arranged and positioned. All of the properties should be valid between transactions.
When are you trying to call Part.move?
I call it inside: myDiagram.addDiagramListener(āClipboardPastedā, function (e){}
Iām trying to deviate the pasted links and nodes for better visibility.
Something link this:
myDiagram.addDiagramListener("ClipboardPasted", function (e) {
var myLoc;
var offset = new go.Point(5, 5);
e.subject.each(function (elem) {
if (elem instanceof go.Node) {
myLoc = elem.location;
elem.move(new go.Point(myLoc.x + offset.x, myLoc.y + offset.y));
}
else if (elem instanceof go.Link) {
myLoc = ???
elem.move(new go.Point(myLoc.x + offset.x, myLoc.y + offset.y));
}
})
});
Take a look at the overrides of CommandHandler.copyToClipboard and CommandHandler.pasteFromClipboard in the DrawCommandHandler class at http://gojs.net/latest/extensions/DrawCommandHandler.js
The basic answer is to call Diagram.moveParts.