myDiagram.position Set in GOJS Version 2.0

myDiagram.position = position
was working on GoJS Version 1.8.37 But it is not working in GOJS Version 2.0.

What is the process to set myDiagram.position Set in GOJS Version 2.0?

That hasn’t changed. If you look at the value of myDiagram.position after the assignment, do you get the same position point as what you set?

In GoJS Version 1.8.37 when run console.log(myDiagram.position); get result “Object { x: -1317.5, y: 354.65 }”

In GoJS Version 2.0 when run console.log(myDiagram.position); get result “Object { C: -1317.5, D: 354.65, v: true }”

In GoJS Version 2.0 position data return as C & D not in X & Y.

Please check.

In any sample using version 2.0, I find that if I evaluate myDiagram.position.x I get the expected number. Or you could evaluate myDiagram.position.toString().

It appears that the minification process substituted the “x” and “y” properties for (in that case, at least), “C” and “D”.

Anyway, back to your original question, the answer is that setting the Diagram.position did work.

I use this & it works.

pt = myDiagram.position;
pt = new go.Point(pt.C, pt.D);

myDiagram.position = pt;

But that code does not work reliably, because it is not using the documented API: Point | GoJS API. If you updated the library or even switched between go.js and go-debug.js, the minified names might be different.

myDiagram.position = new go.Point(pt.x, pt.y);