Node location within a group

I have a group with 4 nodes :
{ key: “CC”, isGroup:true},
{ key: 5, source: “icons/switch.png”, group: “CC”, loc:“100 0”},
{ key: 6, source: “icons/switch.png”, group: “CC”, loc:“200 0” },
{ key: 7, source: “icons/switch.png”, group: “CC”, loc:“300 0” },
{ key: 8, source: “icons/switch.png”, group: “CC”, loc:“400 0” },

when the group is created its location is set by its nodes locations around (98,-20). As expected.
If i move the group to (300,300), via moveTo() method, the group does move to (300,300) but its node locations gets the value of around (300,300), (400, 300)…respectively.
I would expect them to move to
(300+100,300+0), (300+200,300+0)…respectively
namely add the node X value to the group X value and the same for Y.

If the group is at approximately 100,0, then moving the group to 300,300 will shift the nodes by +200,+300. Otherwise the relative locations of the member nodes and the group would change, which is presumably not the intent when calling Part.move.

I guess i didn’t explain my self right.
One execution is done without calling to moveTo, namely the below two lines are commented and i get the result as described above.
The second execution, i un-comment the lines and get the second result as described.

var g = diagram.findNodeForKey(“CC”);

If I understand you correctly, the results are consistent with each other, both before and after calling moveTo on the Group.

When i run the code without moveTo, the nodes location get their original location : (100,0), (200,0),(300,0)…
When i run the code with moveTo(300,300) the nodes location are moved to (300,300), (400,300)…
I excepted that the new node location should be relative to the group location, namely (300+100, 300+0). (300+200, 300+0)…

But you said that the group is correctly located at x==100 initially (approximately). So moving the group to x==300 means that the group and all of its member must shift rightwards by 200.

I see, so from what you’re saying, the group nodes are not moved X=400,X=500 respectively, relative to the group location, but they are shifted by X+=200.
Right ?

Yes. The assumption is that moving a Group should move all of its member Nodes and Links by an equal distance so that the group can continue to look the same.

It make sense,but i expected that the X value of the group should be added to the X value of each node.
Same for Y.