# Find node function/Verible and move individual node

I have mentioned this or queried about this a fair few times with very little success with getting a head start on the requirement that i need.

We have a requirement and this requirement is to select a node when a polygon is (Picture for node link here: http://imgur.com/tBDF08h) And to be able to move that selected node by 5mm via a button of some sorts this would mean only the individual node that is selected can be moved none others.

I hope i have explained myself clear and any questions about my query please ask.

Your button could call:

``````function shift() {
if (myDiagram.selection.count === 0) return;
myDiagram.startTransaction();
myDiagram.selection.each(function(n) {
if (n instanceof go.Node) {
var loc = n.location.copy();
loc.x += 5;  // or whatever you want to do
n.location = loc;
}
});
myDiagram.commitTransaction("shifted");
}
``````

I have just done this in my application but not the result is not what i meant. The requirement that i need is to select a certain node for example: I draw a shape on the canvas there are two nodes available to move when drawing is finished then i would like to select 1 of the nodes out of two nodes that are there and press a button to move only that node not the whole diagram.

Thanks.

If you don’t want to depend on the Diagram.selection collection, you could choose the node(s) that you want to move by searching the collection of Diagram.nodes to find one(s) that meets your criteria.

Or maybe you want to call Diagram.findNodesByExample to search nodes by their model data property values.

what’s the chordates for right and up ?

Positive X is towards the right; negative Y is upwards.

X is indeed towards the right however what I have learned is Y is down Just wondering if there is any other coordinates set to move a node to the left and up if not could I make one?

Thanks

Assign the Node.location to a new Point with a smaller value for X.

I can see how this makes sense, Thank you for the example you shown earlier in this thread there is no Node.location set

Yes, the code above does set Node.location: